usb_event_pending = 1;
}
+/*** Effects ***/
+
+#if 0
+
+static void effect(void)
+{
+ static u32 last_update = 0;
+ static byte b = 0;
+
+ if (ms_ticks - last_update < 30)
+ return;
+ last_update = ms_ticks;
+
+#define DIM 15/16
+ for (uint j=0; j < NPIX_NUM_LEDS; j++)
+ neopixel_set(j, neopixel_leds[j][0]*DIM, neopixel_leds[j][1]*DIM, neopixel_leds[j][2]*DIM);
+ neopixel_set(b, 0, 0, 255);
+ neopixel_set((b + NPIX_NUM_LEDS/3) % NPIX_NUM_LEDS, 0, 255, 0);
+ neopixel_set((b + 2*NPIX_NUM_LEDS/3) % NPIX_NUM_LEDS, 255, 0, 0);
+ b = (b + 1) % NPIX_NUM_LEDS;
+}
+
+#else
+
+static void effect(void)
+{
+ static u32 last_update = 0;
+ static byte b = 0;
+
+ if (ms_ticks - last_update < 60)
+ return;
+ last_update = ms_ticks;
+
+// #define DIM 1/2
+#define DIM 0
+ for (uint j=0; j < NPIX_NUM_LEDS; j++)
+ neopixel_set(j, neopixel_leds[j][0]*DIM, neopixel_leds[j][1]*DIM, neopixel_leds[j][2]*DIM);
+ for (uint k=0; k<NPIX_NUM_LEDS/20; k++) {
+ neopixel_set((b + 20*k) % NPIX_NUM_LEDS, 0, 255, 0);
+ neopixel_set((b + 20*k + 5) % NPIX_NUM_LEDS, 0, 255, 0);
+ }
+ b = (b + 1) % NPIX_NUM_LEDS;
+}
+
+#endif
+
/*** Main ***/
int main(void)
debug_printf("Hello, world!\n");
- uint i=0;
u32 last_blink = 0;
for (;;) {
if (ms_ticks - last_blink >= 100) {
last_blink = ms_ticks;
debug_led_toggle();
+#if 0
if (!got_first_message) {
+ static uint i;
neopixel_set(i, 0, 0, 7);
i = (i+1) % NPIX_NUM_LEDS;
neopixel_set(i, 0, 255, 0);
}
+#endif
}
+ effect();
if (usb_event_pending) {
usbd_poll(usbd_dev);
usb_event_pending = 0;