+ jiffies++;
+ if ((jiffies & 7) == 0) {
+ pixels[start].type = 1;
+ pixels[start].order = 14;
+ }
+
+ if ((jiffies & 7) == 3) {
+ pixels[start].type = 2;
+ pixels[start].order = 0;
+ start += 19;
+ }
+
+ start += 63;
+ if (start >= STRIP_SIZE)
+ start -= STRIP_SIZE;
+
+ for (i = 0; i < STRIP_SIZE; i++) {
+ unsigned char type = pixels[i].type;
+ unsigned char order = pixels[i].order;
+
+ switch (type) {
+ case 0:
+ send_rgb(0, 0, 4);
+ break;
+ case 1:
+ case 3:
+ send_rgb(
+ 6+(1 << (order/2)),
+ 6+(1 << (order/2)),
+ 6+(1 << (order/2))
+ );
+ pixels[i].type = type == 3 ? 2 : 0;;
+ if (order > 1 && i) {
+ pixels[i-1].type = pixels[i-1].type == 2 ? 3 : 1;
+ pixels[i-1].order = order-1;
+ }
+ break;
+ case 2:
+ if (order >= 8) {
+ send_rgb(1 << ((15-order) / 2), 0, 0);
+ } else {
+ send_rgb(1 << (order/2), 0, 0);
+ }
+ if (++order >= 15)
+ pixels[i].type = 0;
+ pixels[i].order = order;
+ break;
+ }
+ }
+
+ end_frame();
+
+ _delay_ms(50);
+#if 0
+ log_byte(0xFa);
+ log_flush();
+#endif