workss
Dependencies: mbed BLE_API nRF51822 VL53L0X
Diff: main.cpp
- Revision:
- 23:52e8e05df60c
- Parent:
- 22:406127954d1f
- Child:
- 24:931eeb8a70fc
--- a/main.cpp Mon Nov 09 17:08:47 2015 +0000 +++ b/main.cpp Thu Mar 07 14:18:32 2019 +0000 @@ -6,7 +6,7 @@ uint16_t readCharUUID = 0xA001; uint16_t writeCharUUID = 0xA002; -const static char DEVICE_NAME[] = "ChangeMe!!"; // change this +const static char DEVICE_NAME[] = "OCCUPY-CRICHTON-ST"; // change this static const uint16_t uuid16_list[] = {0xFFFF}; //Custom UUID, FFFF is reserved for development /* Set Up custom Characteristics */ @@ -20,7 +20,6 @@ GattCharacteristic *characteristics[] = {&readChar, &writeChar}; GattService customService(customServiceUUID, characteristics, sizeof(characteristics) / sizeof(GattCharacteristic *)); - /* * Restart advertising when phone app disconnects */ @@ -29,9 +28,6 @@ BLE::Instance(BLE::DEFAULT_INSTANCE).gap().startAdvertising(); } -/* - * Handle writes to writeCharacteristic -*/ void writeCharCallback(const GattWriteCallbackParams *params) { /* Check to see what characteristic was written, by handle */ @@ -81,10 +77,10 @@ /* Start advertising */ ble.gap().startAdvertising(); } +void wakeup_event_cb() { + led != led; +} -/* - * Main loop -*/ int main(void) { /* initialize stuff */ @@ -93,12 +89,12 @@ BLE& ble = BLE::Instance(BLE::DEFAULT_INSTANCE); ble.init(bleInitComplete); - /* SpinWait for initialization to complete. This is necessary because the - * BLE object is used in the main loop below. */ - while (ble.hasInitialized() == false) { /* spin loop */ } - - /* Infinite loop waiting for BLE interrupt events */ - while (true) { + Ticker ticker; + int counter = 0; + ticker.attach(wakeup_event_cb, 0.3); + while (ble.hasInitialized()) { + counter++; + printf("hello %i!\n", counter); ble.waitForEvent(); /* Save power */ } } \ No newline at end of file