diff options
author | Silvan Jegen <s.jegen@gmail.com> | 2019-08-10 17:40:59 +0200 |
---|---|---|
committer | Silvan Jegen <s.jegen@gmail.com> | 2019-08-10 17:40:59 +0200 |
commit | 8fd7e5e623647866db88b632347261e5d9f30da1 (patch) | |
tree | 4107057e189ac976f5b071420942339e129ce41c /software/first/first.c | |
parent | aa72093ffe1abafd605b5ec3b2d50c20b11c14a9 (diff) |
Implement first version of ISR
Diffstat (limited to 'software/first/first.c')
-rw-r--r-- | software/first/first.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/software/first/first.c b/software/first/first.c index 7505d6c..889e05b 100644 --- a/software/first/first.c +++ b/software/first/first.c @@ -5,28 +5,16 @@ #include "super_blink.h" int main() { - int error = 0; - int ledNum = 0; - int colours[NUM_LEDS] = { - GREEN_LED, - RED_LED, - BLUE_LED, - }; - setup_GPIO(); setup_timer_irq(); - while (!error) { - set_LED(colours[ledNum], ON); - delay(DELAY); - - error = set_LED(colours[ledNum], OFF); - delay(DELAY); - - ledNum++; + // set a delay so the first interrupt handler can fire + delay(DELAY); - if (ledNum >= NUM_LEDS) { - ledNum = 0; - } + while (1) { + // the idea being that delay sets the timer + // for the first interrupt. In the interrupt + // routine, we set the next delay so all we need + // to do here is to loop endlessly } } |