From 56114f7be1e1cb0b88b33e617628e7ad8910a1fa Mon Sep 17 00:00:00 2001 From: twobit Date: Thu, 5 Sep 2013 10:59:21 +0200 Subject: [PATCH] make leds blink --- firmware/apps/mariotheme.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/firmware/apps/mariotheme.c b/firmware/apps/mariotheme.c index 66185d6..ef0bf55 100644 --- a/firmware/apps/mariotheme.c +++ b/firmware/apps/mariotheme.c @@ -112,10 +112,21 @@ static void mix_mario(void) { uint8_t p = order[row]; uint8_t n; + static uint8_t prev_n; + n = pgm_read_byte(&patterns[p][0][note]); if (n == 0) osc[0] = 0; - osc[0] += pgm_read_word(&freq[n]); + else { + // toggle leds on every new beep + if (n != prev_n) { + led_inv(LEFT); + led_inv(RIGHT); + } + osc[0] += pgm_read_word(&freq[n]); + } + prev_n = n; + n = pgm_read_byte(&patterns[p][1][note]); if (n == 0) osc[1] = 0;