]> oss.titaniummirror.com Git - rgblamp.git/blobdiff - rgb.h
mplabx file updates
[rgblamp.git] / rgb.h
diff --git a/rgb.h b/rgb.h
index 663e1890f89f8d9a6f97c4ee1b0b784c60254b47..4456c8075bd500d6a855c42be3cddf033165a363 100644 (file)
--- a/rgb.h
+++ b/rgb.h
@@ -8,21 +8,25 @@
 #ifndef _RGB_H
 #define _RGB_H
 
+#include "isr.h"
+
 /* Initialize the RGB LED assembly.  Outputs are zero, PWM is off. */
 void rgb_init();
 
 /* Turn on the rgb.  Outputs are zero, or last values set by rgb_set(). */
-#define rgb_on() do { TMR2ON = 1; } while (0)
+#define rgb_on() (TMR2ON = 1)
 
 /* Turn off the rgb, first setting outputs to zero. */
 void rgb_off();
 
 /* Set a PWM value for each color LED.  0=off, 255=full on. */
 #define rgb_set(red, grn, blu, wht) do { \
-    CCPR1L = (red); \
+    ndi(); /* FIXME: doesn't seem to fix flicker */ \
+    CCPR3L = (red); \
     CCPR2L = (grn); \
-    CCPR3L = (blu); \
-    CCPR4L = (wht); \
+    CCPR4L = (blu); \
+    CCPR1L = (wht); \
+    nei(); \
 } while (0)
 
 #endif