From 4ac7a3b861887c751ae540641a5e6c4fac8c55be Mon Sep 17 00:00:00 2001 From: Philipp Henkel Date: Sun, 15 Jul 2018 18:38:45 +0200 Subject: [PATCH] Always read from the serial to clear the RX interrupt --- source/drivers/MicroBitSerial.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/drivers/MicroBitSerial.cpp b/source/drivers/MicroBitSerial.cpp index 5fcf9e5..7fad4e0 100644 --- a/source/drivers/MicroBitSerial.cpp +++ b/source/drivers/MicroBitSerial.cpp @@ -88,12 +88,13 @@ MicroBitSerial::MicroBitSerial(PinName tx, PinName rx, uint8_t rxBufferSize, uin */ void MicroBitSerial::dataReceived() { + //get the received character + //Note: always read from the serial to clear the RX interrupt + char c = getc(); + if(!(status & MICROBIT_SERIAL_RX_BUFF_INIT)) return; - //get the received character - char c = getc(); - int delimeterOffset = 0; int delimLength = this->delimeters.length();