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.
Fork of mbed-os-example-ble-LED by
Diff: source/main.cpp
- Revision:
- 25:b08a7d2c30b6
- Parent:
- 24:0770ad9edb2d
--- a/source/main.cpp Mon Apr 03 18:44:40 2017 +0000 +++ b/source/main.cpp Thu Jun 01 16:18:49 2017 +0000 @@ -14,10 +14,9 @@ * limitations under the License. */ -#include <events/mbed_events.h> -#include <mbed.h> -#include "ble/BLE.h" + #include "UARTService.h" +#include "mbed.h" DigitalOut alivenessLED(LED1, 0); DigitalOut actuatedLED(LED2, 0); @@ -55,13 +54,13 @@ } /** - * This callback allows the LEDService to receive updates to the ledState Characteristic. + * This callback allows the UARTService to receive updates to the UART buffer * * @param[in] params * Information about the characterisitc being updated. */ void onDataWrittenCallback(const GattWriteCallbackParams *params) { - char rcv[UARTServicePtr->BLE_UART_SERVICE_MAX_DATA_LEN]; + char* rcv = (char*)malloc(UARTServicePtr->BLE_UART_SERVICE_MAX_DATA_LEN); int c = UARTServicePtr->_getc(); int i = 0; while (c != EOF){ @@ -71,6 +70,7 @@ rcv[UARTServicePtr->BLE_UART_SERVICE_MAX_DATA_LEN-1] = '\0'; printf("%s\r\n", rcv); check_command(rcv); + free(rcv); } /**