BLE Thermometer example
Dependencies: BSP_B-L475E-IOT01
This example is a fork of the following mbed-os example:
https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-Thermometer/
Please read the documentation in this page.
Diff: source/main.cpp
- Revision:
- 11:4e356c89ad66
- Parent:
- 2:cc8349878a7d
- Child:
- 27:0c99c4b33d56
--- a/source/main.cpp Wed Oct 05 05:16:11 2016 +0100 +++ b/source/main.cpp Mon Oct 24 11:15:46 2016 +0100 @@ -14,7 +14,7 @@ * limitations under the License. */ -#include <mbed-events/events.h> +#include <events/mbed_events.h> #include "mbed.h" #include "ble/BLE.h" #include "ble/services/HealthThermometerService.h" @@ -49,7 +49,7 @@ led1 = !led1; /* Do blinky on LED1 while we're waiting for BLE events */ if (BLE::Instance().gap().getState().connected) { - eventQueue.post(updateSensorValue); + eventQueue.call(updateSensorValue); } } @@ -89,20 +89,18 @@ void scheduleBleEventsProcessing(BLE::OnEventsToProcessCallbackContext* context) { BLE &ble = BLE::Instance(); - eventQueue.post(Callback<void()>(&ble, &BLE::processEvents)); + eventQueue.call(Callback<void()>(&ble, &BLE::processEvents)); } int main() { - eventQueue.post_every(500, periodicCallback); + eventQueue.call_every(500, periodicCallback); BLE &ble = BLE::Instance(); ble.onEventsToProcess(scheduleBleEventsProcessing); ble.init(bleInitComplete); - while (true) { - eventQueue.dispatch(); - } + eventQueue.dispatch_forever(); return 0; }