Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed-dev-bin nRF51822-bluetooth-mdw
Fork of microbit-dal by
Revision 8:ec4465853952, committed 2016-04-07
- 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
--- 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...
