microbit-dal: fixed UART service buffer sizing, and re-enabled config options for default services

There was a perspective mismatch with the UART service, where the
actual buffer size given in the constructor, did not reflect the size
of the user buffer that was available to the application. This was not
documented, and hence cause confusion. The patch applied in this
commit, increments the given buffer sizes by one, so that the
application buffer has the available size given in the constructor.

Additionally, some configuration options were lost during the component
refactor, these have now been restored.
master
James Devine 7 years ago
parent 6a78463791
commit 0048a9ac8e

@ -330,9 +330,19 @@ void MicroBitBLEManager::init(ManagedString deviceName, ManagedString serialNumb
setTransmitPower(MICROBIT_BLE_DEFAULT_TX_POWER);
// Bring up core BLE services.
#if CONFIG_ENABLED(MICROBIT_BLE_DFU_SERVICE)
new MicroBitDFUService(*ble);
#endif
#if CONFIG_ENABLED(MICROBIT_BLE_DEVICE_INFORMATION_SERVICE)
DeviceInformationService ble_device_information_service (*ble, MICROBIT_BLE_MANUFACTURER, MICROBIT_BLE_MODEL, serialNumber.toCharArray(), MICROBIT_BLE_HARDWARE_VERSION, MICROBIT_BLE_FIRMWARE_VERSION, MICROBIT_BLE_SOFTWARE_VERSION);
#endif
#if CONFIG_ENABLED(MICROBIT_BLE_EVENT_SERVICE)
new MicroBitEventService(*ble, messageBus);
#else
(void)messageBus;
#endif
// Configure for high speed mode where possible.

@ -67,6 +67,8 @@ void on_confirmation_received_callback(uint16_t handle)
*/
MicroBitUARTService::MicroBitUARTService(BLEDevice &_ble, uint8_t rxBufferSize, uint8_t txBufferSize) : ble(_ble)
{
rxBufferSize += 1;
txBufferSize += 1;
txBuffer = (uint8_t *)malloc(txBufferSize);
rxBuffer = (uint8_t *)malloc(rxBufferSize);

Loading…
Cancel
Save