avr: Implement internal avr specific timer to handle 16bit overflows

Don't rely on the generic scheduler code to always have a timer no
more than 1ms in the future.  Instead, create an avr specific timer
that will be called every 0x8000 ticks.  This simplifies the generic
code and it reduces the amount of code that needs to be run every
millisecond.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-08-06 19:21:16 -04:00
parent 6a63c27542
commit 78982ebb51
5 changed files with 31 additions and 26 deletions

View file

@ -30,12 +30,6 @@ timer_is_before(uint32_t time1, uint32_t time2)
return (int32_t)(time1 - time2) < 0;
}
// Called by main code once every millisecond. (IRQs disabled.)
void
timer_periodic(void)
{
}
static uint32_t timer_repeat_until;
#define TIMER_IDLE_REPEAT_TICKS timer_from_us(500)
#define TIMER_REPEAT_TICKS timer_from_us(100)