From ed103822f5501f08c5d23216a1a505dbdd163f6c Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 1 Jun 2016 12:04:01 -0400 Subject: sched: Change sched_from_ms() to sched_from_us() Some code may require micro-second precision so update sched_from_ms() to use micro-seconds. Signed-off-by: Kevin O'Connor --- src/avr/timer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/avr/timer.c') diff --git a/src/avr/timer.c b/src/avr/timer.c index 8cc3d550..538f0b19 100644 --- a/src/avr/timer.c +++ b/src/avr/timer.c @@ -8,18 +8,18 @@ #include "command.h" // shutdown #include "irq.h" // irq_save #include "sched.h" // sched_timer_kick -#include "timer.h" // timer_from_ms +#include "timer.h" // timer_from_us /**************************************************************** * Low level timer code ****************************************************************/ -// Return the number of clock ticks for a given number of milliseconds +// Return the number of clock ticks for a given number of microseconds uint32_t -timer_from_ms(uint32_t ms) +timer_from_us(uint32_t us) { - return ms * (F_CPU / 1000); + return us * (F_CPU / 1000000); } static inline uint16_t @@ -156,7 +156,7 @@ timer_try_set_next(uint32_t target) // Too many repeat timers from a single interrupt - force a pause timer_repeat = TIMER_MAX_NEXT_REPEAT; next = now + TIMER_DEFER_REPEAT_TICKS; - if (diff < (int16_t)(-timer_from_ms(1))) + if (diff < (int16_t)(-timer_from_us(1000))) goto fail; done: -- cgit v1.2.3-70-g09d2