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 SX1272Lib mbed nRF51822
Fork of BLE_UARTConsole by
Revision 5:2607923acfa1, committed 2014-12-05
- 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
--- 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
