My fork
Dependencies: BLE_API mbed-dev-bin nRF51822-bluetooth-mdw
Fork of microbit-dal-bluetooth-mdw by
Diff: source/drivers/MicroBitSerial.cpp
- Revision:
- 65:f7ebabf23e15
- Parent:
- 62:e633e0eeaf19
- Child:
- 66:2fc7d7c2fffc
diff -r 98cb56bf7711 -r f7ebabf23e15 source/drivers/MicroBitSerial.cpp --- a/source/drivers/MicroBitSerial.cpp Wed Jul 13 12:18:43 2016 +0100 +++ b/source/drivers/MicroBitSerial.cpp Wed Jul 13 12:18:45 2016 +0100 @@ -57,9 +57,8 @@ */ MicroBitSerial::MicroBitSerial(PinName tx, PinName rx, uint8_t rxBufferSize, uint8_t txBufferSize) : RawSerial(tx,rx), delimeters() { - // + 1 so there is a usable buffer size, of the size the user requested. - this->rxBuffSize = rxBufferSize + 1; - this->txBuffSize = txBufferSize + 1; + this->rxBuffSize = rxBufferSize; + this->txBuffSize = txBufferSize; this->rxBuff = NULL; this->txBuff = NULL; @@ -546,7 +545,7 @@ return result; } - int c = getChar(mode); + char c = (char)getChar(mode); unlockRx(); @@ -835,6 +834,7 @@ detach(Serial::RxIrq); + serial_free(&_serial); serial_init(&_serial, tx, rx); attach(this, &MicroBitSerial::dataReceived, Serial::RxIrq); @@ -853,8 +853,6 @@ /** * Configures an event to be fired after "len" characters. * - * Will generate an event with the ID: MICROBIT_ID_SERIAL and the value MICROBIT_SERIAL_EVT_HEAD_MATCH. - * * @param len the number of characters to wait before triggering the event. * * @param mode the selected mode, one of: ASYNC, SYNC_SPINWAIT, SYNC_SLEEP. Each mode @@ -887,9 +885,7 @@ /** * Configures an event to be fired on a match with one of the delimeters. * - * Will generate an event with the ID: MICROBIT_ID_SERIAL and the value MICROBIT_SERIAL_EVT_DELIM_MATCH. - * - * @param delimeters the characters to match received characters against e.g. ManagedString("\n") + * @param delimeters the characters to match received characters against e.g. ManagedString("\r\n") * * @param mode the selected mode, one of: ASYNC, SYNC_SPINWAIT, SYNC_SLEEP. Each mode * gives a different behaviour: @@ -961,8 +957,7 @@ lockRx(); - // + 1 so there is a usable buffer size, of the size the user requested. - this->rxBuffSize = size + 1; + this->rxBuffSize = size; int result = initialiseRx(); @@ -986,8 +981,7 @@ lockTx(); - // + 1 so there is a usable buffer size, of the size the user requested. - this->txBuffSize = size + 1; + this->txBuffSize = size; int result = initialiseTx();