+#define LED_MAX (2*STRIP_SIZE/5)
+#define N_COLORS 8
+#define R_BIAS(x) ((x) << 3)
+#define G_BIAS(x) ((x) >> 1)
+#define B_BIAS(x) ((x) << 1)
+
+static void do_hue()
+{
+ static unsigned char color, led_off;
+ static uint16_t jiffies;
+ unsigned char i, c0, l0;
+
+ if ((jiffies++ & 0x03f) == 0) {
+ if (++led_off >= LED_MAX) {
+ led_off = 0;
+ color++;
+ if (color >= 3*N_COLORS)
+ color = 0;
+ }
+ }
+
+ l0 = led_off;
+ c0 = color;
+
+ for (i = 0; i < STRIP_SIZE; i++) {
+ if (c0 < N_COLORS) {
+ send_rgb(R_BIAS(N_COLORS-c0), G_BIAS(c0), 0);
+ } else if (c0 < 2*N_COLORS) {
+ send_rgb(0, G_BIAS(2*N_COLORS-c0), B_BIAS(c0-N_COLORS));
+ } else {
+ send_rgb(R_BIAS(c0-2*N_COLORS), 0, B_BIAS(3*N_COLORS-c0));
+ }
+
+ if (++l0 >= LED_MAX) {
+ l0 = 0;
+ c0++;
+ if (c0 >= 3*N_COLORS)
+ c0 = 0;
+ }
+ }
+ end_frame();
+}
+