sen data via radio to other microbits accept command via radio bufixes

Dependencies:   BLE_API nRF51822 mbed-dev-bin

Revision:
65:f7ebabf23e15
Parent:
64:98cb56bf7711
Child:
66:2fc7d7c2fffc
--- a/source/drivers/MicroBitRadio.cpp	Wed Jul 13 12:18:43 2016 +0100
+++ b/source/drivers/MicroBitRadio.cpp	Wed Jul 13 12:18:45 2016 +0100
@@ -59,6 +59,10 @@
 
 extern "C" void RADIO_IRQHandler(void)
 {
+    // Move on to the next buffer, if possible.
+    MicroBitRadio::instance->queueRxBuf();
+    NRF_RADIO->PACKETPTR = (uint32_t) MicroBitRadio::instance->getRxBuf();
+
     if(NRF_RADIO->EVENTS_READY)
     {
         NRF_RADIO->EVENTS_READY = 0;
@@ -70,24 +74,12 @@
     if(NRF_RADIO->EVENTS_END)
     {
         NRF_RADIO->EVENTS_END = 0;
+
         if(NRF_RADIO->CRCSTATUS == 1)
         {
             uint8_t sample = NRF_RADIO->RSSISAMPLE;
 
-            // Associate this packet's rssi value with the data just 
-            // transferred by DMA receive
             MicroBitRadio::instance->setRSSI(sample);
-
-            // Now move on to the next buffer, if possible.
-            // The queued packet will get the rssi value set above.
-            MicroBitRadio::instance->queueRxBuf();
-
-            // Set the new buffer for DMA
-            NRF_RADIO->PACKETPTR = (uint32_t) MicroBitRadio::instance->getRxBuf();
-        }
-        else
-        {
-            MicroBitRadio::instance->setRSSI(0);
         }
 
         // Start listening and wait for the END event