Skip to content
Snippets Groups Projects
Commit 69c6db98 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

arduino nano: ignore non-timer interrupts for loop

parent fd1aabd0
No related branches found
No related tags found
No related merge requests found
...@@ -32,10 +32,14 @@ void wakeup(); ...@@ -32,10 +32,14 @@ void wakeup();
#if defined(WITH_LOOP) || defined(TIMER_S) #if defined(WITH_LOOP) || defined(TIMER_S)
#include "driver/uptime.h" #include "driver/uptime.h"
void loop();
#endif #endif
#if defined(WITH_LOOP)
extern void loop();
volatile char run_loop = 0;
#endif
void Arch::idle_loop(void) void Arch::idle_loop(void)
{ {
while (1) { while (1) {
...@@ -44,13 +48,13 @@ void Arch::idle_loop(void) ...@@ -44,13 +48,13 @@ void Arch::idle_loop(void)
SMCR = 0; SMCR = 0;
asm("wdr"); asm("wdr");
#ifdef WITH_LOOP #ifdef WITH_LOOP
loop(); if (run_loop) {
loop();
run_loop = 0;
}
#endif #endif
#ifdef WITH_WAKEUP #ifdef WITH_WAKEUP
wakeup(); wakeup();
#endif
#ifdef TIMER_S
uptime.tick_s();
#endif #endif
} }
} }
...@@ -79,6 +83,12 @@ Arch arch; ...@@ -79,6 +83,12 @@ Arch arch;
ISR(TIMER1_COMPA_vect) ISR(TIMER1_COMPA_vect)
{ {
#ifdef WITH_LOOP
run_loop = 1;
#endif
#ifdef TIMER_S
uptime.tick_s();
#endif
} }
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment