14 #include <propeller.h>
22 uint32_t ledColors[LED_COUNT];
28 uint32_t pattern[] = {
37 #define pattern_count (sizeof(pattern) / sizeof(pattern[0]))
43 void alternate(
int count,
int delay);
44 void chase(
int count,
int delay);
73 void alternate(
int count,
int delay)
76 ledColors[0] = COLOR_GREEN;
77 ledColors[1] = COLOR_RED;
78 ledColors[2] = COLOR_RED;
79 ledColors[3] = COLOR_GREEN;
82 while (count < 0 || --count >= 0) {
85 ledColors[0] = ledColors[1];
86 ledColors[1] = ledColors[3];
87 ledColors[2] = ledColors[3];
88 ledColors[3] = ledColors[0];
91 ws2812_set(driver, LED_PIN, ledColors, LED_COUNT);
99 void chase(
int count,
int delay)
105 while (count < 0 || --count >= 0) {
109 for (i = 0; i < LED_COUNT; ++i) {
110 ledColors[i] = pattern[idx];
111 if (++idx >= pattern_count)
114 if (++base >= pattern_count)
118 ws2812_set(driver, LED_PIN, ledColors, LED_COUNT);