X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fcc1111%2Fao_radio.c;h=07b0d1b5d3882c1f62826c7965e353ebf2a4ebf1;hb=f677a83348a9568679240ee9d731ab454f289831;hp=cb2c2fddba411fee29ea427bd11f44b402d96fd7;hpb=583458772746317b98fced907ec780edff465888;p=fw%2Faltos diff --git a/src/cc1111/ao_radio.c b/src/cc1111/ao_radio.c index cb2c2fdd..07b0d1b5 100644 --- a/src/cc1111/ao_radio.c +++ b/src/cc1111/ao_radio.c @@ -322,7 +322,7 @@ ao_radio_send(__xdata void *packet, uint8_t size) __reentrant } uint8_t -ao_radio_recv(__xdata void *packet, uint8_t size) __reentrant +ao_radio_recv(__xdata void *packet, uint8_t size, uint8_t timeout) __reentrant { ao_radio_abort = 0; ao_radio_get(size - 2); @@ -342,9 +342,13 @@ ao_radio_recv(__xdata void *packet, uint8_t size) __reentrant /* Wait for DMA to be done, for the radio receive process to * get aborted or for a receive timeout to fire */ + if (timeout) + ao_alarm(timeout); __critical while (!ao_radio_dma_done && !ao_radio_abort) if (ao_sleep(&ao_radio_dma_done)) break; + if (timeout) + ao_clear_alarm(); /* If recv was aborted, clean up by stopping the DMA engine * and idling the radio