aboutsummaryrefslogtreecommitdiff
path: root/task.c
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2017-04-29 15:44:30 -0400
committerPaul Selkirk <paul@psgd.org>2017-04-29 15:44:30 -0400
commite234cacf79a496d20a113d1141e7607089fc6e8e (patch)
treee1f9e743a86d65bc485c0bf43472ea3c478e5d25 /task.c
parentf77ba50cbbc119baa9f90a092407d06caa56e9e2 (diff)
Add task_delay.
Diffstat (limited to 'task.c')
-rw-r--r--task.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/task.c b/task.c
index 980ca1d..600b679 100644
--- a/task.c
+++ b/task.c
@@ -316,3 +316,13 @@ tcb_t *task_iterate(tcb_t *t)
return t->next;
}
+
+/* Delay a number of 1ms ticks.
+ */
+void task_delay(uint32_t delay)
+{
+ uint32_t tickstart = HAL_GetTick();
+
+ while ((HAL_GetTick() - tickstart) < delay)
+ task_yield();
+}