A basic demo where a message sent over a BLE UART gets displayed on a low-power eInk display.

Dependencies:   BLE_API SharpLCD mbed nRF51822

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Fri Aug 01 07:07:12 2014 +0000
Parent:
1:5f4043f4c997
Child:
3:fc93699018c9
Commit message:
add trailing null byte to rxPayload

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Aug 01 07:06:03 2014 +0000
+++ b/main.cpp	Fri Aug 01 07:07:12 2014 +0000
@@ -68,6 +68,9 @@
         DEBUG("onDataWritten()\n\r");
         uint16_t bytesRead;
         ble.readCharacteristicValue(rxCharacteristic.getHandle(), rxPayload, &bytesRead);
+        if (bytesRead < sizeof(rxPayload)) {
+            rxPayload[bytesRead] = 0;
+        }
         DEBUG("ECHO: %s\n\r", (char *)rxPayload);
         ble.updateCharacteristicValue(txCharacteristic.getHandle(), rxPayload, bytesRead);
         rxPayloadUpdated = true;