diff options
author | Keith Packard <keithp@keithp.com> | 2013-04-28 23:05:18 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-05-07 20:07:52 -0700 |
commit | f09b2fc7fcfb1b3dcb1a46a8b9856092dd59866b (patch) | |
tree | 8df57a5c9f3260149645ed7889f32eb06601eb7f /src | |
parent | b878ca38045b1bee6ea4d649298727ac3fa197c2 (diff) |
altos: Clear any broken cc1120 TX fifo bits before transmitting
This just goes and clears the transmitter before using it, just in
case it got wedged somehow. It also clears the bits while waiting for
the radio to go idle, otherwise it'd never make it.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/ao_cc1120.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index bad0c856..07ebf835 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -272,6 +272,8 @@ ao_radio_idle(void) uint8_t state = ao_radio_strobe(CC1120_SIDLE); if ((state >> CC1120_STATUS_STATE) == CC1120_STATUS_STATE_IDLE) break; + if ((state >> CC1120_STATUS_STATE) == CC1120_STATUS_STATE_TX_FIFO_ERROR) + ao_radio_strobe(CC1120_SFTX); } /* Flush any pending TX bytes */ ao_radio_strobe(CC1120_SFTX); @@ -715,11 +717,17 @@ ao_radio_send(const void *d, uint8_t size) uint8_t this_len; uint8_t started = 0; uint8_t fifo_space; + uint8_t q; encode_len = ao_fec_encode(d, size, tx_data); ao_radio_get(encode_len); + ao_radio_abort = 0; + + /* Flush any pending TX bytes */ + ao_radio_strobe(CC1120_SFTX); + started = 0; fifo_space = CC1120_FIFO_SIZE; while (encode_len) { |