unsigned char duration: 5;
} pattern_t;
+#define PATTERN_FOREVER 0x1F
#define PATTERN_END { 0, 0 }
extern pattern_t off_pattern[];
extern pattern_t on_pattern[];
void patterns_next_tick();
void led_set_status(unsigned char status);
void led_set_pattern(unsigned char led, pattern_t *pattern);
+pattern_t *number_pattern(unsigned char num);
/* buttons.c */
#define MAX_USER_PARAMS 3
static pattern_t *led_patterns[N_LEDS];
pattern_t off_pattern[] = {
- { 0, 0x1F },
- PATTERN_END
+ { 0, PATTERN_FOREVER },
};
pattern_t on_pattern[] = {
- { 1, 0x1F },
- PATTERN_END
+ { 1, PATTERN_FOREVER },
};
pattern_t blink_pattern[] = {
{ 1, 0x1 }, /* 2 */
{ 0, 0x5 },
{ 1, 0x1 }, /* 1 */
- { 0, 0x1F },
+ { 0, 0x1E },
PATTERN_END
};
{
unsigned char i;
- for (i = 0; i < N_LEDS; i++) {
- led_counters[i] = 0;
- led_patterns[i] = off_pattern;
- }
+ for (i = 0; i < N_LEDS; i++)
+ led_set_pattern(i, off_pattern);
+
led_set_pattern(N_PWMLEDS+1, boot_pattern);
test_running = 0;
}
led_set_pattern(i, p);
}
- led_counters[i]--;
+ if (led_counters[i] < PATTERN_FOREVER)
+ led_counters[i]--;
}
}