diff options
Diffstat (limited to 'src/arch/arduino-nano')
-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 |