summaryrefslogtreecommitdiff
path: root/src/ao_packet_slave.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-26 16:14:15 -0800
committerKeith Packard <keithp@keithp.com>2010-12-22 20:39:40 -0800
commit07213dc34fa20470a4b36a327a83d75b0f010ebb (patch)
treea85d444ab7d2ccf01153c15e6fb2adf8473b602f /src/ao_packet_slave.c
parentb62580855c5144f5bc7e0172289bce08814d9472 (diff)
altos: clean up radio abort paths. Share radio code.
Instead of aborting the DMA and radio operation and expecting that to be handled reasonably by the radio receiving task, rewrite things so that the abort function just wakes the receiving task while that terminates the DMA and cleans up the radio. This eliminates all kinds of nasty bugs dealing with radio abort smashing the radio registers at the wrong time, or interrupting a radio transmission. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_packet_slave.c')
-rw-r--r--src/ao_packet_slave.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/ao_packet_slave.c b/src/ao_packet_slave.c
index 9b78767f..3040d781 100644
--- a/src/ao_packet_slave.c
+++ b/src/ao_packet_slave.c
@@ -20,14 +20,11 @@
void
ao_packet_slave(void)
{
- uint8_t status;
-
ao_radio_set_packet();
ao_tx_packet.addr = ao_serial_number;
ao_tx_packet.len = AO_PACKET_SYN;
while (ao_packet_enable) {
- status = ao_packet_recv();
- if (status & AO_DMA_DONE) {
+ if (ao_packet_recv()) {
memcpy(&ao_tx_packet.callsign, &ao_rx_packet.packet.callsign, AO_MAX_CALLSIGN);
ao_packet_send();
}
@@ -47,7 +44,7 @@ ao_packet_slave_stop(void)
{
if (ao_packet_enable) {
ao_packet_enable = 0;
- ao_radio_abort();
+ ao_radio_recv_abort();
while (ao_packet_task.wchan) {
ao_wake_task(&ao_packet_task);
ao_yield();