Forked to avoid changing the publioc repo
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
diff -r d73a257e9f89 -r 122814b3e76e source/drivers/MicroBitSerial.cpp --- 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();