From 118fd21cb815d1c27e7e5bd6b394369bdf095919 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 12 Jul 2017 22:16:16 -0400 Subject: irq: Support sleeping when mcu is idle Signed-off-by: Kevin O'Connor --- src/avr/timer.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/avr/timer.c') diff --git a/src/avr/timer.c b/src/avr/timer.c index 92459af3..d9397187 100644 --- a/src/avr/timer.c +++ b/src/avr/timer.c @@ -6,6 +6,7 @@ #include // TCNT1 #include "autoconf.h" // CONFIG_AVR_CLKPR +#include "basecmd.h" // stats_note_sleep #include "board/misc.h" // timer_from_us #include "command.h" // shutdown #include "irq.h" // irq_save @@ -62,6 +63,12 @@ timer_set(uint16_t next) OCR1A = next; } +static inline uint16_t +timer_get_next(void) +{ + return OCR1A; +} + static inline void timer_repeat_set(uint16_t next) { @@ -103,6 +110,9 @@ timer_init(void) // enable interrupt TIMSK1 = 1<