diff options
author | Paulo Borges <paulo.borges@openbossa.org> | 2013-12-25 00:50:35 -0300 |
---|---|---|
committer | Paulo Borges <paulo.borges@openbossa.org> | 2013-12-25 23:54:11 -0300 |
commit | aef3b47359d1509854f18dc5c213733eb716a25f (patch) | |
tree | 44b2b4c40b495d9302944e0b03f1a8f1d650e7ff | |
parent | 0626b56e3dc8d8bb65d3a0190e0effd8327fd8d7 (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; |