diff options
author | Keith Packard <keithp@keithp.com> | 2012-08-24 00:27:13 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-08-24 00:27:13 -0700 |
commit | 7a0ed0ff4192060854d69e640de2c30105eb2f62 (patch) | |
tree | b46fb17c9aa12eb7f49e9d4402a5a2dff529b76d /src/drivers/ao_pad.c | |
parent | 659c0cd3ee4b9581c12ac2cd1b4162bf07a921ce (diff) |
altos: Disable telefire 'pad' listener when testing radio
Ensures that the radio testing won't block waiting for a firing mode
packet to arrive.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_pad.c')
-rw-r--r-- | src/drivers/ao_pad.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c index 21aa788d..b6dbcefe 100644 --- a/src/drivers/ao_pad.c +++ b/src/drivers/ao_pad.c @@ -71,6 +71,23 @@ ao_pad_status(void) static __pdata uint8_t ao_pad_armed; static __pdata uint16_t ao_pad_arm_time; static __pdata uint8_t ao_pad_box; +static __xdata uint8_t ao_pad_disabled; + +void +ao_pad_disable(void) +{ + if (!ao_pad_disabled) { + ao_pad_disabled = 1; + ao_radio_recv_abort(); + } +} + +void +ao_pad_enable(void) +{ + ao_pad_disabled = 0; + ao_wakeup (&ao_pad_disabled); +} static void ao_pad(void) @@ -85,6 +102,8 @@ ao_pad(void) ao_pad_box = ao_74hc497_read(); for (;;) { flush(); + while (ao_pad_disabled) + ao_sleep(&ao_pad_disabled); if (ao_radio_cmac_recv(&command, sizeof (command), 0) != AO_RADIO_CMAC_OK) continue; |