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
Diff: source/drivers/MicroBitSerial.cpp
- Revision:
- 60:122814b3e76e
- Parent:
- 59:d73a257e9f89
- Child:
- 61:b597fb218f84
--- a/source/drivers/MicroBitSerial.cpp Wed Jul 13 12:18:39 2016 +0100
+++ b/source/drivers/MicroBitSerial.cpp Wed Jul 13 12:18:39 2016 +0100
@@ -57,8 +57,9 @@
*/
MicroBitSerial::MicroBitSerial(PinName tx, PinName rx, uint8_t rxBufferSize, uint8_t txBufferSize) : RawSerial(tx,rx), delimeters()
{
- this->rxBuffSize = rxBufferSize;
- this->txBuffSize = txBufferSize;
+ // + 1 so there is a usable buffer size, of the size the user requested.
+ this->rxBuffSize = rxBufferSize + 1;
+ this->txBuffSize = txBufferSize + 1;
this->rxBuff = NULL;
this->txBuff = NULL;
@@ -961,7 +962,8 @@
lockRx();
- this->rxBuffSize = size;
+ // + 1 so there is a usable buffer size, of the size the user requested.
+ this->rxBuffSize = size + 1;
int result = initialiseRx();
@@ -985,7 +987,8 @@
lockTx();
- this->txBuffSize = size;
+ // + 1 so there is a usable buffer size, of the size the user requested.
+ this->txBuffSize = size + 1;
int result = initialiseTx();
