diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-06-01 12:04:01 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-06-02 17:52:11 -0400 |
commit | ed103822f5501f08c5d23216a1a505dbdd163f6c (patch) | |
tree | 17363ef740f2328076282e226539ffa85adc19e6 /src/avr/timer.c | |
parent | d68cb264c421be687c53066df91c7ffb661ab2d9 (diff) | |
download | kutter-ed103822f5501f08c5d23216a1a505dbdd163f6c.tar.gz kutter-ed103822f5501f08c5d23216a1a505dbdd163f6c.tar.xz kutter-ed103822f5501f08c5d23216a1a505dbdd163f6c.zip |
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 <kevin@koconnor.net>
Diffstat (limited to 'src/avr/timer.c')
-rw-r--r-- | src/avr/timer.c | 10 |
1 files changed, 5 insertions, 5 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: |