msn
Dependencies: BLE_API mbed nRF51822
Fork of BLE_LEDBlinker by
Diff: main.cpp
- Revision:
- 3:146eba831693
- Parent:
- 2:3e1e967035cb
- Child:
- 4:460ce53dc854
--- a/main.cpp Mon Jun 08 06:30:35 2015 +0000 +++ b/main.cpp Mon Jun 08 06:37:03 2015 +0000 @@ -20,13 +20,13 @@ #include "DiscoveredService.h" BLEDevice ble; -DigitalOut led1(LED1); +DigitalOut alivenessLED(LED1, 1); bool triggerLedCharacteristic = false; DiscoveredCharacteristic ledCharacteristic; void periodicCallback(void) { - led1 = !led1; /* Do blinky on LED1 while we're waiting for BLE events */ + alivenessLED = !alivenessLED; /* Do blinky on LED1 while we're waiting for BLE events */ } void advertisementCallback(const Gap::AdvertisementCallbackParams_t *params) { @@ -98,7 +98,6 @@ } int main(void) { - led1 = 1; Ticker ticker; ticker.attach(periodicCallback, 1); @@ -106,6 +105,8 @@ ble.onConnection(connectionCallback); ble.onDisconnection(disconnectionCallback); + /* Request for comments: should setupOnDataRead() be a static for DiscoveredCharacteristic? + * Or should it be passed in as a parameter to read()? */ DiscoveredCharacteristic::setupOnDataRead(triggerToggledWrite); DiscoveredCharacteristic::setupOnDataWrite(triggerRead);