diff options
author | Keith Packard <keithp@keithp.com> | 2017-12-12 15:30:45 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-12-12 15:30:45 -0800 |
commit | db352bd0723e8d640bb034bc14e5ad193f0afe1d (patch) | |
tree | 3f414896a52bfaea41c4c5bfe8b4e3b2473aba57 /src/kernel/ao_notask.c | |
parent | 09ea349f5b37e257e8ca23ead493ba1694395530 (diff) |
altos/kernel: Allow ao_cmd to be built without tasking
Useful for single-threaded applications, like lambdakey
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_notask.c')
-rw-r--r-- | src/kernel/ao_notask.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/kernel/ao_notask.c b/src/kernel/ao_notask.c index 00fe1ed6..7207353a 100644 --- a/src/kernel/ao_notask.c +++ b/src/kernel/ao_notask.c @@ -39,6 +39,21 @@ ao_sleep(__xdata void *wchan) return 0; } +#if HAS_AO_DELAY +void +ao_delay(uint16_t ticks) +{ + AO_TICK_TYPE target; + + if (!ticks) + ticks = 1; + target = ao_tick_count + ticks; + do { + ao_sleep(&ao_time); + } while ((int16_t) (target - ao_tick_count) > 0); +} +#endif + void ao_wakeup(__xdata void *wchan) { |