]> www.fi.muni.cz Git - bike-lights.git/blobdiff - firmware/pattern.c
firmware: buttons-press and pwrdown rework
[bike-lights.git] / firmware / pattern.c
index fa885cbb97bbdda10483a55f7d6bdce734a4c805..2e06b67e476fca2c35dad4fe0ef7e39648bff413 100644 (file)
@@ -2,20 +2,19 @@
 
 #include "lights.h"
 
-typedef struct {
-       unsigned char mode: 3;
-       unsigned char duration: 5;
-} pattern_t;
-
 static unsigned char led_counters[N_LEDS];
 static pattern_t *led_patterns[N_LEDS];
 
-#define PATTERN_END { 0, 0 }
 pattern_t off_pattern[] = {
        { 0, 0x1F },
        PATTERN_END
 };
 
+pattern_t on_pattern[] = {
+       { 1, 0x1F },
+       PATTERN_END
+};
+
 pattern_t blink_pattern[] = {
        { 1, 0x4 },
        { 0, 0x8 },
@@ -55,6 +54,7 @@ pattern_t boot_pattern[] = {
 };
 
 pattern_t pattern_num[] = {
+       { 0, 0x5 },
        { 1, 0x1 }, /* 10 */
        { 0, 0x5 },
        { 1, 0x1 }, /*  9 */
@@ -117,7 +117,7 @@ static pattern_t *number_pattern(unsigned char num)
                num = 9;
 
        return pattern_num + sizeof(pattern_num)/sizeof(pattern_t)
-               - 1 - 2*num;
+               - 2 - 2*num;
 }
 
 static inline pattern_t *pattern_select(unsigned char n)