Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed-dev-bin nRF51822
Fork of microbit-dal by
Revision 64:98cb56bf7711, committed 2016-07-13
- Comitter:
- LancasterUniversity
- Date:
- Wed Jul 13 12:18:43 2016 +0100
- Parent:
- 63:b4372a29994f
- Child:
- 65:f7ebabf23e15
- Commit message:
- Synchronized with git rev 07b6f7f6
Author: Joe Finney
microbit: CRC check bugfix to MicroBitRadio #150
Integrated @whs-che patch as documented in #150, which prevents packets with a
failed CRC checksum from being processed.
Changed in this revision
| source/drivers/MicroBitRadio.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/drivers/MicroBitRadio.cpp Wed Jul 13 12:18:42 2016 +0100
+++ b/source/drivers/MicroBitRadio.cpp Wed Jul 13 12:18:43 2016 +0100
@@ -59,10 +59,6 @@
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;
@@ -74,12 +70,24 @@
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
