projects
/
fw
/
altos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4f7ed9f
)
Use ao_alarm for ao_delay so it can be easily interrupted
author
Keith Packard
<keithp@keithp.com>
Sat, 31 Oct 2009 08:19:41 +0000
(
01:19
-0700)
committer
Keith Packard
<keithp@keithp.com>
Sat, 31 Oct 2009 08:19:41 +0000
(
01:19
-0700)
src/ao_timer.c
patch
|
blob
|
history
diff --git
a/src/ao_timer.c
b/src/ao_timer.c
index 78c6e063f0991eb5c71e628b652cca08e928c02b..d76034354339f675c1e33c49270688ccf18afa3f 100644
(file)
--- a/
src/ao_timer.c
+++ b/
src/ao_timer.c
@@
-24,13
+24,13
@@
uint16_t ao_time(void) __critical
return ao_tick_count;
}
return ao_tick_count;
}
+static __xdata uint8_t ao_forever;
+
void
ao_delay(uint16_t ticks)
{
void
ao_delay(uint16_t ticks)
{
- uint16_t until = ao_time() + ticks;
-
- while ((int16_t) (until - ao_time()) > 0)
- ao_sleep(DATA_TO_XDATA(&ao_tick_count));
+ ao_alarm(ticks);
+ ao_sleep(&ao_forever);
}
#define T1_CLOCK_DIVISOR 8 /* 24e6/8 = 3e6 */
}
#define T1_CLOCK_DIVISOR 8 /* 24e6/8 = 3e6 */