#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