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 | |
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>
-rw-r--r-- | src/cc1111/ao_radio.c | 9 | ||||
-rw-r--r-- | src/drivers/ao_pad.c | 19 | ||||
-rw-r--r-- | src/drivers/ao_pad.h | 6 |
3 files changed, 34 insertions, 0 deletions
diff --git a/src/cc1111/ao_radio.c b/src/cc1111/ao_radio.c index 2071c47a..46b2362d 100644 --- a/src/cc1111/ao_radio.c +++ b/src/cc1111/ao_radio.c @@ -16,6 +16,9 @@ */ #include "ao.h" +#if HAS_PAD +#include <ao_pad.h> +#endif /* Values from SmartRF® Studio for: * @@ -485,6 +488,9 @@ ao_radio_test(void) #if PACKET_HAS_SLAVE ao_packet_slave_stop(); #endif +#if HAS_PAD + ao_pad_disable(); +#endif ao_radio_get(0xff); RFST = RFST_STX; radio_on = 1; @@ -501,6 +507,9 @@ ao_radio_test(void) #if HAS_MONITOR ao_monitor_enable(); #endif +#if HAS_PAD + ao_pad_enable(); +#endif } } 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; diff --git a/src/drivers/ao_pad.h b/src/drivers/ao_pad.h index 9ea016ff..d5ca3a88 100644 --- a/src/drivers/ao_pad.h +++ b/src/drivers/ao_pad.h @@ -64,4 +64,10 @@ struct ao_pad_query { void ao_pad_init(void); +void +ao_pad_disable(void); + +void +ao_pad_enable(void); + #endif /* _AO_PAD_H_ */ |