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-dev nRF51822
Diff: main.cpp
- Revision:
- 26:78ee13f69ec3
- Parent:
- 25:094df0d9e95b
- Child:
- 27:7370b8994603
--- a/main.cpp Mon Aug 22 17:40:43 2016 +0000
+++ b/main.cpp Mon Aug 22 22:50:25 2016 +0000
@@ -15,7 +15,7 @@
*/
#include "mbed.h"
-#include "Timeout.h"
+#include "Ticker.h"
#include "HIDController_BLE.h"
@@ -220,10 +220,11 @@
// (pulled-up and two MCP23017 is configured with open drain INT)
InterruptIn buttonInt(P0_5);
-Timeout timeout;
+Ticker ticker;
+DigitalOut statusLed(P0_4, 1);
+
// Unsed pins. Set to output for power consumption
-DigitalIn unused_p0_4(P0_4, PullUp);
DigitalIn unused_p0_7(P0_7, PullUp);
DigitalIn unused_p0_6(P0_6, PullUp);
DigitalIn unused_p0_15(P0_15, PullUp);
@@ -251,6 +252,10 @@
NRF_POWER->SYSTEMOFF = 1;
}
+void tickerStatus() {
+ statusLed = !statusLed;
+}
+
int main(void) {
printf("init\r\n");
@@ -258,6 +263,8 @@
// DO NOT CONNECT RTS/CTS AUTOMATICALY!
NRF_UART0->PSELRTS = 0xFFFFFFFFUL;
NRF_UART0->PSELCTS = 0xFFFFFFFFUL;
+
+ ticker.attach(tickerStatus, 1);
// 100kHz