#include "lights.h"
-#define N_LEDS 1
+#define N_LEDS 2
static unsigned char led_counters[N_LEDS];
static pattern_t *led_patterns[N_LEDS];
static void led_set_mode(unsigned char n, unsigned char mode)
{
- if (n == 0) {
- pwmled_on_off(mode);
+ switch (n) {
+ case 0: pwmled_on_off(mode); break;
+ case 1: status_led_on_off(mode); break;
}
}
static pattern_t *pattern_select(unsigned char n)
{
- static unsigned char count;
- static unsigned char mode;
switch(n) {
- case 0:
- if (++count > 2) {
- count = 0;
- if (mode == 0) {
- mode = 3;
- } else {
- mode = 0;
- }
-
- pwmled_set_target(mode);
- }
- return number_pattern(mode ? 2 : 3, 0);
+ case 0: return pwmled_pattern_select();
+ case 1: return status_led_pattern_select();
default: return NULL;
}
}
static void inline pattern_finished(unsigned char n)
{
- unsigned char i;
-
led_patterns[n] = NULL;
-
- if (n == 0) {
- led_set_pattern(0, pattern_select(0));
- }
-#if 0
- } else if (n == 3) {
- if (!led_patterns[4])
- led_set_pattern(4, pattern_select(4));
- } else if (n == 4) {
- if (!led_patterns[3])
- led_set_pattern(3, pattern_select(3));
- } else {
- led_set_pattern(n, pattern_select(n));
- }
-#endif
+ led_set_pattern(n, pattern_select(n));
}
void patterns_next_tick()