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 60:122814b3e76e, committed 2016-07-13
- Comitter:
- LancasterUniversity
- Date:
- Wed Jul 13 12:18:39 2016 +0100
- Parent:
- 59:d73a257e9f89
- Child:
- 61:b597fb218f84
- Commit message:
- Synchronized with git rev ee2af2c4
Author: James Devine
microbit-dal: MicroBitSerial +1 to buffer sizes, to give usable buffer of the size requested
Changed in this revision
| source/drivers/MicroBitSerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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();
