#include "isr.h"
+/* Optional brightness compensation. Pick zero or one */
+#define CEIL256
+#undef CEIL32
+
/* Initialize the RGB LED assembly. Outputs are zero, PWM is off. */
void rgb_init();
void rgb_off();
/* Set a PWM value for each color LED. 0=off, 255=full on. */
+#ifdef CEIL256
+extern const unsigned char pwm_table[];
+#define rgb_set(red, grn, blu, wht) do { \
+ ndi(); /* FIXME: doesn't seem to fix flicker */ \
+ CCPR3L = pwm_table[(red)]; \
+ CCPR2L = pwm_table[(grn)]; \
+ CCPR4L = pwm_table[(blu)]; \
+ CCPR1L = pwm_table[(wht)]; \
+ nei(); \
+} while (0)
+#else
+#ifdef CEIL32
+extern const unsigned char pwm_table[];
+#define rgb_set(red, grn, blu, wht) do { \
+ ndi(); /* FIXME: doesn't seem to fix flicker */ \
+ CCPR3L = pwm_table[(red) >> 3]; \
+ CCPR2L = pwm_table[(grn) >> 3]; \
+ CCPR4L = pwm_table[(blu) >> 3]; \
+ CCPR1L = pwm_table[(wht) >> 3]; \
+ nei(); \
+} while (0)
+#else
#define rgb_set(red, grn, blu, wht) do { \
ndi(); /* FIXME: doesn't seem to fix flicker */ \
CCPR3L = (red); \
CCPR1L = (wht); \
nei(); \
} while (0)
+#endif
+#endif
#endif