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:
Thu Apr 07 23:39:34 2016 +0100
Parent:
7:a4042bbb7f8b
Child:
9:960ce8922159
Commit message:
Synchronized with git rev 6702a5f5
Author: James Devine
microbit-dal: Zero initialised C99 compatible buffers

Changed in this revision

source/bluetooth/MicroBitUARTService.cpp Show annotated file Show diff for this revision Revisions of this file
source/drivers/MicroBitLightSensor.cpp Show annotated file Show diff for this revision Revisions of this file
source/drivers/MicroBitSerial.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/bluetooth/MicroBitUARTService.cpp	Thu Apr 07 23:39:33 2016 +0100
+++ b/source/bluetooth/MicroBitUARTService.cpp	Thu Apr 07 23:39:34 2016 +0100
@@ -256,6 +256,8 @@
 
         uint8_t temp[size];
 
+        memclr(&temp, size);
+
         circularCopy(txBuffer, txBufferSize, temp, txBufferTail, txBufferHead);
 
 #if CONFIG_ENABLED(MICROBIT_DBG)
@@ -361,6 +363,8 @@
 {
     uint8_t buf[len + 1];
 
+    memclr(&buf, len + 1);
+
     int ret = read(buf, len, mode);
 
     if(ret < 1)
@@ -428,6 +432,8 @@
 
         uint8_t localBuff[localBuffSize + 1];
 
+        memclr(&localBuff, localBuffSize + 1);
+
         circularCopy(rxBuffer, rxBufferSize, localBuff, preservedTail, foundIndex);
 
         //plus one for the character we listened for...
--- a/source/drivers/MicroBitLightSensor.cpp	Thu Apr 07 23:39:33 2016 +0100
+++ b/source/drivers/MicroBitLightSensor.cpp	Thu Apr 07 23:39:34 2016 +0100
@@ -87,6 +87,9 @@
 {
     this->chan = 0;
 
+    for(int i = 0; i < MICROBIT_LIGHT_SENSOR_CHAN_NUM; i++)
+        results[i] = 0;
+
     if (EventModel::defaultEventBus)
         EventModel::defaultEventBus->listen(MICROBIT_ID_DISPLAY, MICROBIT_DISPLAY_EVT_LIGHT_SENSE, this, &MicroBitLightSensor::startSensing, MESSAGE_BUS_LISTENER_IMMEDIATE);
 
@@ -174,4 +177,4 @@
 {
     if (EventModel::defaultEventBus)
         EventModel::defaultEventBus->ignore(MICROBIT_ID_DISPLAY, MICROBIT_DISPLAY_EVT_LIGHT_SENSE, this, &MicroBitLightSensor::startSensing);
-}
+}
\ No newline at end of file
--- a/source/drivers/MicroBitSerial.cpp	Thu Apr 07 23:39:33 2016 +0100
+++ b/source/drivers/MicroBitSerial.cpp	Thu Apr 07 23:39:34 2016 +0100
@@ -567,6 +567,8 @@
 {
     uint8_t buff[size + 1];
 
+    memclr(&buff, size + 1);
+
     int returnedSize = read((uint8_t *)buff, size, mode);
 
     if(returnedSize <= 0)
@@ -758,6 +760,8 @@
 
         uint8_t localBuff[localBuffSize + 1];
 
+        memclr(&localBuff, localBuffSize + 1);
+
         circularCopy(rxBuff, rxBuffSize, localBuff, preservedTail, foundIndex);
 
         //plus one for the character we listened for...