-/* The index of all step arrays is the fast variable, 0=slow, 1=fast. */
-#if 0
-const static unsigned min_incolor_steps[2] = { 320, 32 };
-const static unsigned range_incolor_steps[2] = { 32768, 128 };
-const static int min_fade_steps[2] = { 64, 32 };
-const static int range_fade_steps[2] = { 416, 128 };
+/* Available colors, 6 bits per color (no values above 0x3f) */
+const unsigned char colors[COLOR_COUNT][LED_COUNT] = {
+ { 0x28, 0x00, 0x00, 0x00 }, /* red */
+ { 0x30, 0x20, 0x00, 0x00 }, /* orange */
+ { 0x2c, 0x2c, 0x00, 0x00 }, /* yellow */
+ { 0x20, 0x2c, 0x00, 0x00 }, /* yellow-green */
+ { 0x00, 0x30, 0x00, 0x00 }, /* green */
+ { 0x00, 0x30, 0x18, 0x00 }, /* green-cyan */
+ { 0x00, 0x30, 0x28, 0x00 }, /* cyan */
+ { 0x00, 0x18, 0x30, 0x00 }, /* cyan-blue */
+ { 0x00, 0x00, 0x30, 0x00 }, /* blue */
+ { 0x1c, 0x00, 0x30, 0x00 }, /* magenta */
+ { 0x3f, 0x3f, 0x3f, 0x3f }, /* white */
+};
+
+unsigned char mode = MODE_SOLID;
+unsigned char color = COLOR_WHITE;
+led_t red;
+led_t grn;
+led_t blu;
+led_t wht;
+bit on;
+int fade_steps;
+signed char bright = BRIGHT_INIT;
+bit bright_up;
+signed char pbHeldCount;
+
+/* Return the constrained brightness level for use in computing RGB values */
+unsigned char bright_get()
+{
+ if (bright > BRIGHT_MAX)
+ return BRIGHT_MAX;
+ else if (bright < BRIGHT_MIN)
+ return BRIGHT_MIN;
+ else
+ return bright;
+}
+
+/* RGB values will not illuminate the LED */
+unsigned char led_get(unsigned value)
+{
+ value = (value * bright_get()) >> 8;
+#ifdef CEIL256
+ if (value && value < 0x26)
+ return 0x26;