updates

Dependencies:   BLE_API mbed-dev-bin nRF51822

Fork of microbit-dal-eddystone by Martin Woolley

Files at this revision

API Documentation at this revision

Comitter:
LancasterUniversity
Date:
Wed Jul 13 12:18:07 2016 +0100
Parent:
28:379e18ebd43b
Child:
30:db87179335d5
Commit message:
Synchronized with git rev 0048a9ac
Author: James Devine
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.

Changed in this revision

source/bluetooth/MicroBitBLEManager.cpp Show annotated file Show diff for this revision Revisions of this file
source/bluetooth/MicroBitUARTService.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/bluetooth/MicroBitBLEManager.cpp	Wed Jul 13 12:18:06 2016 +0100
+++ b/source/bluetooth/MicroBitBLEManager.cpp	Wed Jul 13 12:18:07 2016 +0100
@@ -330,9 +330,19 @@
     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.
--- a/source/bluetooth/MicroBitUARTService.cpp	Wed Jul 13 12:18:06 2016 +0100
+++ b/source/bluetooth/MicroBitUARTService.cpp	Wed Jul 13 12:18:07 2016 +0100
@@ -67,6 +67,8 @@
  */
 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);