aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/avr/timer.c10
-rw-r--r--src/avr/timer.h2
-rw-r--r--src/basecmd.c2
-rw-r--r--src/sched.c12
-rw-r--r--src/sched.h2
-rw-r--r--src/simulator/main.c2
-rw-r--r--src/simulator/timer.h2
7 files changed, 16 insertions, 16 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);
diff --git a/src/basecmd.c b/src/basecmd.c
index b94c820a..113cc30e 100644
--- a/src/basecmd.c
+++ b/src/basecmd.c
@@ -205,7 +205,7 @@ stats_task(void)
sumsq = nextsumsq;
static uint32_t prev;
- if (sched_is_before(cur, prev + sched_from_ms(5000)))
+ if (sched_is_before(cur, prev + sched_from_us(5000000)))
return;
sendf("stats count=%u sum=%u sumsq=%u", count, cur - prev, sumsq);
prev = cur;
diff --git a/src/sched.c b/src/sched.c
index 2f51515c..a25f43e2 100644
--- a/src/sched.c
+++ b/src/sched.c
@@ -9,9 +9,9 @@
#include <stddef.h> // NULL
#include "autoconf.h" // CONFIG_*
#include "board/irq.h" // irq_save
-#include "board/timer.h" // timer_from_ms
+#include "board/timer.h" // timer_from_us
#include "command.h" // shutdown
-#include "sched.h" // sched_from_ms
+#include "sched.h" // sched_from_us
#include "stepper.h" // stepper_event
@@ -30,7 +30,7 @@ ms_event(struct timer *t)
{
millis++;
timer_periodic();
- t->waketime += sched_from_ms(1);
+ t->waketime += sched_from_us(1000);
return SF_RESCHEDULE;
}
@@ -52,11 +52,11 @@ sched_check_periodic(uint16_t time, uint16_t *pnext)
return 1;
}
-// 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
-sched_from_ms(uint32_t ms)
+sched_from_us(uint32_t us)
{
- return timer_from_ms(ms);
+ return timer_from_us(us);
}
// Return the current time (in clock ticks)
diff --git a/src/sched.h b/src/sched.h
index 047ac1ce..be73ce65 100644
--- a/src/sched.h
+++ b/src/sched.h
@@ -23,7 +23,7 @@ enum { SF_DONE=0, SF_RESCHEDULE=1 };
// sched.c
uint8_t sched_check_periodic(uint16_t time, uint16_t *pnext);
-uint32_t sched_from_ms(uint32_t ms);
+uint32_t sched_from_us(uint32_t us);
uint32_t sched_read_time(void);
uint8_t sched_is_before(uint32_t time1, uint32_t time2);
void sched_timer(struct timer*);
diff --git a/src/simulator/main.c b/src/simulator/main.c
index 2d43a138..e871864a 100644
--- a/src/simulator/main.c
+++ b/src/simulator/main.c
@@ -17,7 +17,7 @@ uint8_t Interrupt_off;
****************************************************************/
uint32_t
-timer_from_ms(uint32_t ms)
+timer_from_us(uint32_t us)
{
return 0; // XXX
}
diff --git a/src/simulator/timer.h b/src/simulator/timer.h
index f35b8278..71b64502 100644
--- a/src/simulator/timer.h
+++ b/src/simulator/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);