diff options
author | Paulo Borges <paulo.borges@openbossa.org> | 2013-12-25 00:50:35 -0300 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@gmail.com> | 2013-12-27 14:20:22 -0300 |
commit | f8476324d3ffb233eab2c95a35a672cc0e4c7e1a (patch) | |
tree | f1c38ce878e96a751ce67646fedc4757f63137a0 | |
parent | 9f7fa62f0065463f98c784f6e6dcb2f51922374c (diff) |
nrf51822: Implement radio_stop()
-rw-r--r-- | platform/nrf51822/radio.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/nrf51822/radio.c b/platform/nrf51822/radio.c index 5656ec3..82b26d4 100644 --- a/platform/nrf51822/radio.c +++ b/platform/nrf51822/radio.c @@ -111,6 +111,20 @@ int16_t radio_recv(uint8_t ch, uint32_t aa, uint32_t crc) return 0; } +int16_t radio_stop(void) +{ + if (!(status & STATUS_BUSY)) + return -1; + + NRF_RADIO->EVENTS_DISABLED = 0UL; + NRF_RADIO->TASKS_DISABLE = 1UL; + while (NRF_RADIO->EVENTS_DISABLED == 0UL); + + status &= ~STATUS_BUSY; + + return 0; +} + void radio_register_handler(radio_handler hdlr) { handler = hdlr; |