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 mbed nRF51822
Fork of BLE_Button by
Revision 20:7d2043754467, committed 2016-07-18
- Comitter:
- 0xf10
- Date:
- Mon Jul 18 14:55:35 2016 +0000
- Parent:
- 19:3807de5c6a58
- Commit message:
- force deepsleep
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Jun 21 19:22:32 2016 +0000
+++ b/main.cpp Mon Jul 18 14:55:35 2016 +0000
@@ -179,9 +179,7 @@
}
int main(void)
-{
- Ticker ticker;
-
+{
// Turn off all LED's
led1 = !0; led2 = !0; led3 = !0;
@@ -208,6 +206,7 @@
button5.rise(button5ReleasedCallback);
// This will make our green led blink
+ Ticker ticker;
ticker.attach(periodicCallback, 1);
BLE &ble = BLE::Instance();
@@ -223,7 +222,7 @@
if (buttonState != IDLE) {
if(buttonState == PRESSED) led1=!1;
if(buttonState == RELEASED) led1=!0;
-
+ ticker.attach(periodicCallback, 1);
updateManufacturerData();
cnt = 0;
buttonState = IDLE;
@@ -242,6 +241,9 @@
if(cnt > 3){
ble.gap().stopAdvertising();
led3 = !0;
+ led2 = !0;
+ ticker.detach();
+ deepsleep();
}else{
if(!gpioSet()) cnt++;
}
