X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=firmware%2Fpattern.c;h=f5f8fc6f8003ab9a92761e4d9992e46b0081c022;hb=ee55592455c9628ca21142449d4b5918a59151fe;hp=55b1648bb162659b5a0eb3ece2558a5d356a037b;hpb=87b9093fd54402618c297aaacbfa68bad80302e9;p=bike-lights.git diff --git a/firmware/pattern.c b/firmware/pattern.c index 55b1648..f5f8fc6 100644 --- a/firmware/pattern.c +++ b/firmware/pattern.c @@ -9,6 +9,11 @@ pattern_t off_pattern[] = { { 0, PATTERN_FOREVER }, }; +pattern_t zero_pattern[] = { + { 0, 0x10 }, + PATTERN_END +}; + pattern_t on_pattern[] = { { 1, PATTERN_FOREVER }, }; @@ -20,9 +25,9 @@ pattern_t blink_pattern[] = { }; pattern_t mode1_pattern[] = { - { 4, 0x1 }, + { 2, 0x1 }, { 0, 0x1 }, - { 4, 0x1 }, + { 2, 0x1 }, { 0, 0x8 }, { 1, 0x1 }, { 0, 0x1 }, @@ -102,7 +107,7 @@ void pattern_init() unsigned char i; for (i = 0; i < N_LEDS; i++) - led_set_pattern(i, off_pattern); + led_set_pattern(i, zero_pattern); led_set_pattern(N_PWMLEDS+1, boot_pattern); test_running = 0; @@ -119,9 +124,7 @@ pattern_t *number_pattern(unsigned char num) static inline pattern_t *pattern_select(unsigned char n) { - if (n < N_PWMLEDS && !pwmled_enabled(n)) - return off_pattern; // Don't mess with non-enabled LEDs - else if (n == 2) + if (n < N_PWMLEDS) return mode1_pattern; else if (n == 3) return status_pattern_select(0); @@ -149,7 +152,3 @@ void patterns_next_tick() } } -void led_set_status(unsigned char status) -{ - led_set_pattern(N_PWMLEDS+1, number_pattern(status)); -}