diff options
-rw-r--r-- | src/avr/timer.c | 19 | ||||
-rw-r--r-- | src/generic/timer.c | 7 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/avr/timer.c b/src/avr/timer.c index 588669c1..e9ec8dd0 100644 --- a/src/avr/timer.c +++ b/src/avr/timer.c @@ -95,15 +95,6 @@ timer_init(void) } DECL_INIT(timer_init); -static void -timer_shutdown(void) -{ - // Reenable timer irq - timer_set(timer_get() + 50); - TIFR1 = 1<<OCF1A; -} -DECL_SHUTDOWN(timer_shutdown); - /**************************************************************** * 32bit timer wrappers @@ -208,3 +199,13 @@ timer_task(void) irq_enable(); } DECL_TASK(timer_task); + +static void +timer_shutdown(void) +{ + // Reenable timer irq + timer_set(timer_get() + 50); + TIFR1 = 1<<OCF1A; + timer_repeat_set(timer_get() + TIMER_IDLE_REPEAT_TICKS); +} +DECL_SHUTDOWN(timer_shutdown); diff --git a/src/generic/timer.c b/src/generic/timer.c index 256ccb3d..5185ed54 100644 --- a/src/generic/timer.c +++ b/src/generic/timer.c @@ -94,3 +94,10 @@ timer_task(void) irq_enable(); } DECL_TASK(timer_task); + +static void +timer_irq_shutdown(void) +{ + timer_repeat_until = timer_read_time() + TIMER_IDLE_REPEAT_TICKS; +} +DECL_SHUTDOWN(timer_irq_shutdown); |