Capstone / Mbed 2 deprecated BLE_UARTConsole_with_SX1272

Dependencies:   BLE_API SX1272Lib mbed nRF51822

Fork of BLE_UARTConsole by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Fri Dec 05 09:51:39 2014 +0000
Parent:
4:6e389d8897bf
Child:
6:0f16ba78cb1e
Commit message:
switch to using UARTService.write() instead of printf().

Changed in this revision

BLE_API.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
nRF51822.lib Show annotated file Show diff for this revision Revisions of this file
--- a/BLE_API.lib	Wed Nov 05 14:27:12 2014 +0000
+++ b/BLE_API.lib	Fri Dec 05 09:51:39 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#fede41ce9407
+http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#2c414d3240a8
--- a/main.cpp	Wed Nov 05 14:27:12 2014 +0000
+++ b/main.cpp	Fri Dec 05 09:51:39 2014 +0000
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include <string.h>
 #include "mbed.h"
 #include "BLEDevice.h"
 
@@ -23,13 +24,14 @@
                                * it will have an impact on code-size and power consumption. */
 
 #if NEED_CONSOLE_OUTPUT
-#define DEBUG(...) { printf(__VA_ARGS__); }
+#define DEBUG(STR) { if (uart) uart->write(STR, strlen(STR)); }
 #else
 #define DEBUG(...) /* nothing */
 #endif /* #if NEED_CONSOLE_OUTPUT */
 
 BLEDevice  ble;
 DigitalOut led1(LED1);
+UARTService *uart;
 
 void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
 {
@@ -53,6 +55,8 @@
     DEBUG("Initialising the nRF51822\n\r");
     ble.init();
     ble.onDisconnection(disconnectionCallback);
+    
+    uart = new UARTService(ble);
 
     /* setup advertising */
     ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
@@ -65,9 +69,6 @@
     ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */
     ble.startAdvertising();
 
-    UARTService uartService(ble);
-    uartService.retargetStdout();
-
     while (true) {
         ble.waitForEvent();
     }
--- a/nRF51822.lib	Wed Nov 05 14:27:12 2014 +0000
+++ b/nRF51822.lib	Fri Dec 05 09:51:39 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#61da91a52bd6
+http://mbed.org/teams/Nordic-Semiconductor/code/nRF51822/#cdcc094ab166