diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-10-12 10:45:24 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-10-12 10:45:24 +0200 |
commit | 69c6db98f12f1fe103a1177ec37444bc3024645f (patch) | |
tree | 86a1f30f27a7ad8a58103a0f3c51e8adb6702413 /src/arch/arduino-nano/arch.cc | |
parent | fd1aabd0417bef53e7ff54df52eba80be5494d56 (diff) |
arduino nano: ignore non-timer interrupts for loop
Diffstat (limited to 'src/arch/arduino-nano/arch.cc')
-rw-r--r-- | src/arch/arduino-nano/arch.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/arch/arduino-nano/arch.cc b/src/arch/arduino-nano/arch.cc index 7f18c38..3009637 100644 --- a/src/arch/arduino-nano/arch.cc +++ b/src/arch/arduino-nano/arch.cc @@ -32,10 +32,14 @@ void wakeup(); #if defined(WITH_LOOP) || defined(TIMER_S) #include "driver/uptime.h" -void loop(); #endif +#if defined(WITH_LOOP) +extern void loop(); +volatile char run_loop = 0; +#endif + void Arch::idle_loop(void) { while (1) { @@ -44,14 +48,14 @@ void Arch::idle_loop(void) SMCR = 0; asm("wdr"); #ifdef WITH_LOOP - loop(); + if (run_loop) { + loop(); + run_loop = 0; + } #endif #ifdef WITH_WAKEUP wakeup(); #endif -#ifdef TIMER_S - uptime.tick_s(); -#endif } } @@ -79,6 +83,12 @@ Arch arch; ISR(TIMER1_COMPA_vect) { +#ifdef WITH_LOOP + run_loop = 1; +#endif +#ifdef TIMER_S + uptime.tick_s(); +#endif } #endif |