diff options
Diffstat (limited to 'src/avr')
-rw-r--r-- | src/avr/timer.c | 10 | ||||
-rw-r--r-- | src/avr/timer.h | 2 |
2 files changed, 6 insertions, 6 deletions
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: diff --git a/src/avr/timer.h b/src/avr/timer.h index 2165fecd..188d8a98 100644 --- a/src/avr/timer.h +++ b/src/avr/timer.h @@ -3,7 +3,7 @@ #include <stdint.h> -uint32_t timer_from_ms(uint32_t ms); +uint32_t timer_from_us(uint32_t us); void timer_periodic(void); uint32_t timer_read_time(void); uint8_t timer_set_next(uint32_t next); |