From: Jan "Yenya" Kasprzak Date: Wed, 29 Aug 2012 22:46:09 +0000 (+0200) Subject: pattern.c: handle both GPIO LEDs X-Git-Tag: gedasymbols-20120913~32 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=66dbf8c04a632ad64f68aad6c775af6a5f5b12e8;p=bike-lights.git pattern.c: handle both GPIO LEDs --- diff --git a/pattern.c b/pattern.c index c2942e5..9999749 100644 --- 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)