X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pattern.c;h=8552240d304165b2dd0378f4b88ea6b2cc083a32;hb=6e520930d8d0b0ed0085671ea844c1cc419812b0;hp=0245c3b679cb8e08080b67c1f08f38193cf9b02c;hpb=dbbcaf6e61197990ec21a702102c81deb66f2110;p=bike-lights.git diff --git a/pattern.c b/pattern.c index 0245c3b..8552240 100644 --- a/pattern.c +++ b/pattern.c @@ -12,7 +12,7 @@ static pattern_t *led_patterns[N_LEDS]; #define PATTERN_END { 0, 0 } pattern_t off_pattern[] = { - { 0, 5 }, + { 0, 0x1F }, PATTERN_END }; @@ -22,24 +22,51 @@ pattern_t blink_pattern[] = { PATTERN_END }; -pattern_t pattern_num[] = { +pattern_t mode1_pattern[] = { + { 1, 0x1F }, + PATTERN_END +}; + +pattern_t boot_pattern[] = { + { 1, 0x6 }, + { 0, 0x6 }, + { 1, 0x3 }, + { 0, 0x3 }, + { 1, 0x2 }, + { 0, 0x2 }, { 1, 0x1 }, - { 0, 0x4 }, + { 0, 0x1 }, { 1, 0x1 }, - { 0, 0x4 }, + { 0, 0x1 }, { 1, 0x1 }, - { 0, 0x4 }, + { 0, 0x1 }, { 1, 0x1 }, + { 0, 0x1 }, + { 1, 0x10 }, + { 0, 0x10 }, + PATTERN_END +}; + +pattern_t pattern_num[] = { + { 1, 0x1 }, /* 10 */ { 0, 0x4 }, - { 1, 0x1 }, + { 1, 0x1 }, /* 9 */ { 0, 0x4 }, - { 1, 0x1 }, + { 1, 0x1 }, /* 8 */ { 0, 0x4 }, - { 1, 0x1 }, + { 1, 0x1 }, /* 7 */ { 0, 0x4 }, - { 1, 0x1 }, + { 1, 0x1 }, /* 6 */ { 0, 0x4 }, - { 1, 0x1 }, + { 1, 0x1 }, /* 5 */ + { 0, 0x4 }, + { 1, 0x1 }, /* 4 */ + { 0, 0x4 }, + { 1, 0x1 }, /* 3 */ + { 0, 0x4 }, + { 1, 0x1 }, /* 2 */ + { 0, 0x4 }, + { 1, 0x1 }, /* 1 */ { 0, 0x1F }, PATTERN_END }; @@ -52,11 +79,13 @@ void pattern_init() led_counters[i] = 0; led_patterns[i] = off_pattern; } + led_patterns[N_PWMLEDS] = boot_pattern; + led_counters[N_PWMLEDS] = boot_pattern->duration; + gpio_set(GPIO_LED2, 1); } static inline pattern_t *pattern_select(unsigned char n) { - log_byte(ambient_zone); return pattern_num + sizeof(pattern_num)/sizeof(pattern_t) - 1 - 2*(1+ambient_zone);; }