forking microbit-dal

Dependencies:   BLE_API mbed-dev-bin nRF51822-bluetooth-mdw

Fork of microbit-dal by Martin Woolley

Files at this revision

API Documentation at this revision

Comitter:
LancasterUniversity
Date:
Thu Apr 07 11:59:16 2016 +0100
Parent:
2:557d9ac9e959
Child:
4:9fbeeb89de59
Commit message:
Synchronized with git rev 387c4f18
Author: James Devine
microbit-dal: fixed C99 incompatible array initialisation.

Removed { 0 }; from all buffer initialisations.

Also replaced all uses of Serial::IrqType:: with IrqType::

Changed in this revision

inc/bluetooth/MicroBitBLEManager.h Show annotated file Show diff for this revision Revisions of this file
inc/drivers/MicroBitLightSensor.h Show annotated file Show diff for this revision Revisions of this file
inc/drivers/MicroBitStorage.h 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
source/drivers/DynamicPwm.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/inc/bluetooth/MicroBitBLEManager.h	Thu Apr 07 00:55:10 2016 +0000
+++ b/inc/bluetooth/MicroBitBLEManager.h	Thu Apr 07 11:59:16 2016 +0100
@@ -75,7 +75,7 @@
 
 struct BLESysAttribute
 {
-    uint8_t         sys_attr[8] = { 0 };
+    uint8_t         sys_attr[8];
 };
 
 struct BLESysAttributeStore
@@ -212,4 +212,4 @@
 
 };
 
-#endif
+#endif
\ No newline at end of file
--- a/inc/drivers/MicroBitLightSensor.h	Thu Apr 07 00:55:10 2016 +0000
+++ b/inc/drivers/MicroBitLightSensor.h	Thu Apr 07 11:59:16 2016 +0100
@@ -48,7 +48,7 @@
 {
 
     //contains the results from each section of the display
-    int results[MICROBIT_LIGHT_SENSOR_CHAN_NUM] = { 0 };
+    int results[MICROBIT_LIGHT_SENSOR_CHAN_NUM];
 
     //holds the current channel (also used to index the results array)
     uint8_t chan;
@@ -134,4 +134,4 @@
     ~MicroBitLightSensor();
 };
 
-#endif
+#endif
\ No newline at end of file
--- a/inc/drivers/MicroBitStorage.h	Thu Apr 07 00:55:10 2016 +0000
+++ b/inc/drivers/MicroBitStorage.h	Thu Apr 07 11:59:16 2016 +0100
@@ -42,8 +42,8 @@
 
 struct KeyValuePair
 {
-    uint8_t key[MICROBIT_STORAGE_KEY_SIZE] = { 0 };
-    uint8_t value[MICROBIT_STORAGE_VALUE_SIZE] = { 0 };
+    uint8_t key[MICROBIT_STORAGE_KEY_SIZE];
+    uint8_t value[MICROBIT_STORAGE_VALUE_SIZE];
 };
 
 struct KeyValueStore
@@ -230,4 +230,4 @@
     int size();
 };
 
-#endif
+#endif
\ No newline at end of file
--- a/source/bluetooth/MicroBitUARTService.cpp	Thu Apr 07 00:55:10 2016 +0000
+++ b/source/bluetooth/MicroBitUARTService.cpp	Thu Apr 07 11:59:16 2016 +0100
@@ -254,7 +254,7 @@
         SERIAL_DEBUG->printf("tx size: %d", size);
 #endif
 
-        uint8_t temp[size] = { 0 };
+        uint8_t temp[size];
 
         circularCopy(txBuffer, txBufferSize, temp, txBufferTail, txBufferHead);
 
@@ -359,7 +359,7 @@
   */
 ManagedString MicroBitUARTService::read(int len, MicroBitSerialMode mode)
 {
-    uint8_t buf[len + 1] = { 0 };
+    uint8_t buf[len + 1];
 
     int ret = read(buf, len, mode);
 
@@ -426,7 +426,7 @@
         //calculate our local buffer size
         int localBuffSize = (preservedTail > foundIndex) ? (rxBufferSize - preservedTail) + foundIndex : foundIndex - preservedTail;
 
-        uint8_t localBuff[localBuffSize + 1] = { 0 };
+        uint8_t localBuff[localBuffSize + 1];
 
         circularCopy(rxBuffer, rxBufferSize, localBuff, preservedTail, foundIndex);
 
@@ -536,4 +536,4 @@
         return (txBufferSize - txBufferTail) + txBufferHead;
 
     return txBufferHead - txBufferTail;
-}
+}
\ No newline at end of file
--- a/source/drivers/DynamicPwm.cpp	Thu Apr 07 00:55:10 2016 +0000
+++ b/source/drivers/DynamicPwm.cpp	Thu Apr 07 11:59:16 2016 +0100
@@ -35,7 +35,7 @@
 #include "MicroBitPin.h"
 #include "ErrorNo.h"
 
-DynamicPwm* DynamicPwm::pwms[NO_PWMS] = { NULL };
+DynamicPwm* DynamicPwm::pwms[NO_PWMS] = { NULL, NULL, NULL };
 
 uint8_t DynamicPwm::lastUsed = NO_PWMS+1; //set it to out of range i.e. 4 so we know it hasn't been used yet.
 
@@ -328,4 +328,4 @@
 int DynamicPwm::setPeriod(int period)
 {
     return setPeriodUs(period * 1000);
-}
+}
\ No newline at end of file
--- a/source/drivers/MicroBitSerial.cpp	Thu Apr 07 00:55:10 2016 +0000
+++ b/source/drivers/MicroBitSerial.cpp	Thu Apr 07 11:59:16 2016 +0100
@@ -148,7 +148,7 @@
     if(nextTail == txBuffHead)
     {
         MicroBitEvent(MICROBIT_ID_NOTIFY, MICROBIT_SERIAL_EVT_TX_EMPTY);
-        detach(Serial::IrqType::TxIrq);
+        detach(IrqType::TxIrq);
     }
 
     //update our tail!
@@ -185,7 +185,7 @@
     fiber_wake_on_event(MICROBIT_ID_NOTIFY, MICROBIT_SERIAL_EVT_TX_EMPTY);
 
     //set the TX interrupt
-    attach(this, &MicroBitSerial::dataWritten, Serial::IrqType::TxIrq);
+    attach(this, &MicroBitSerial::dataWritten, IrqType::TxIrq);
 
     return copiedBytes;
 }
@@ -231,7 +231,7 @@
     if((status & MICROBIT_SERIAL_RX_BUFF_INIT))
     {
         //ensure that we receive no interrupts after freeing our buffer
-        detach(Serial::IrqType::RxIrq);
+        detach(IrqType::RxIrq);
         free(this->rxBuff);
     }
 
@@ -245,7 +245,7 @@
 
     //set the receive interrupt
     status |= MICROBIT_SERIAL_RX_BUFF_INIT;
-    attach(this, &MicroBitSerial::dataReceived, Serial::IrqType::RxIrq);
+    attach(this, &MicroBitSerial::dataReceived, IrqType::RxIrq);
 
     return MICROBIT_OK;
 }
@@ -259,7 +259,7 @@
     if((status & MICROBIT_SERIAL_TX_BUFF_INIT))
     {
         //ensure that we receive no interrupts after freeing our buffer
-        detach(Serial::IrqType::TxIrq);
+        detach(IrqType::TxIrq);
         free(this->txBuff);
     }
 
@@ -565,7 +565,7 @@
   */
 ManagedString MicroBitSerial::read(int size, MicroBitSerialMode mode)
 {
-    uint8_t buff[size + 1] = { 0 };
+    uint8_t buff[size + 1];
 
     int returnedSize = read((uint8_t *)buff, size, mode);
 
@@ -756,7 +756,7 @@
         //calculate our local buffer size
         int localBuffSize = (preservedTail > foundIndex) ? (rxBuffSize - preservedTail) + foundIndex : foundIndex - preservedTail;
 
-        uint8_t localBuff[localBuffSize + 1] = { 0 };
+        uint8_t localBuff[localBuffSize + 1];
 
         circularCopy(rxBuff, rxBuffSize, localBuff, preservedTail, foundIndex);
 
@@ -813,17 +813,17 @@
     lockRx();
 
     if(txBufferedSize() > 0)
-        detach(Serial::IrqType::TxIrq);
+        detach(IrqType::TxIrq);
 
-    detach(Serial::IrqType::RxIrq);
+    detach(IrqType::RxIrq);
 
     serial_free(&_serial);
     serial_init(&_serial, tx, rx);
 
-    attach(this, &MicroBitSerial::dataReceived, Serial::IrqType::RxIrq);
+    attach(this, &MicroBitSerial::dataReceived, IrqType::RxIrq);
 
     if(txBufferedSize() > 0)
-        attach(this, &MicroBitSerial::dataWritten, Serial::IrqType::TxIrq);
+        attach(this, &MicroBitSerial::dataWritten, IrqType::TxIrq);
 
     this->baud(this->baudrate);
 
@@ -1096,4 +1096,4 @@
 {
     //we detach by sending a bad value to attach, for some weird reason...
     attach((MicroBitSerial *)NULL, &MicroBitSerial::dataReceived, interruptType);
-}
+}
\ No newline at end of file