summaryrefslogtreecommitdiff
path: root/src/stm/ao_timer.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-10-25 13:42:10 -0700
committerKeith Packard <keithp@keithp.com>2012-10-26 14:07:04 -0700
commite57ab2a7bfb69c0ef9b5b7fa8e53e20a500e7c6c (patch)
tree08d961311a7d2e7612d5c9aa090fd7a1dcdd53e6 /src/stm/ao_timer.c
parentccf0faa7d26d56deca7928b521d07be40504466a (diff)
altos: Provide ao_task_alarm_tick to reduce per-tick cost
Cache the next wakeup time and check that before jumping to the task code. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/ao_timer.c')
-rw-r--r--src/stm/ao_timer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stm/ao_timer.c b/src/stm/ao_timer.c
index d69035f8..e07625d8 100644
--- a/src/stm/ao_timer.c
+++ b/src/stm/ao_timer.c
@@ -44,7 +44,8 @@ void stm_tim6_isr(void)
stm_tim6.sr = 0;
++ao_tick_count;
#if HAS_TASK_QUEUE
- ao_task_check_alarm((uint16_t) ao_tick_count);
+ if (ao_task_alarm_tick && (int16_t) (ao_tick_count - ao_task_alarm_tick) >= 0)
+ ao_task_check_alarm((uint16_t) ao_tick_count);
#endif
#if AO_DATA_ALL
if (++ao_data_count == ao_data_interval) {