]> www.fi.muni.cz Git - bike-lights.git/commitdiff
pattern.c: handle both GPIO LEDs
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 29 Aug 2012 22:46:09 +0000 (00:46 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 31 Aug 2012 21:08:11 +0000 (23:08 +0200)
pattern.c

index c2942e59c9bdbda3c7693e526b31238d82b5f7f0..9999749fd2fe794952bbc16d83cc6f8704486636 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -85,8 +85,8 @@ 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;
+       led_patterns[N_PWMLEDS+1] = boot_pattern;
+       led_counters[N_PWMLEDS+1] = boot_pattern->duration;
        gpio_set(GPIO_LED2, 1);
        test_running = 0;
 }
@@ -123,10 +123,9 @@ static void led_set_mode(unsigned char n, unsigned char mode)
 {
        if (n < N_PWMLEDS) {
                pwmled_set_mode(n, mode);
-       } else if (n == N_PWMLEDS) {
-               gpio_set(GPIO_LED2, mode);
+       } else if (n < N_LEDS) {
+               gpio_set(n - N_PWMLEDS, mode);
        }
-       // TODO LED 1
 }
 
 static void inline led_set_level(unsigned char n, unsigned char level)