Hiroh Satoh / keyboard Featured

Dependencies:   BLE_API mbed-dev nRF51822

Revision:
27:7370b8994603
Parent:
26:78ee13f69ec3
Child:
28:1f843a3daab0
--- a/main.cpp	Mon Aug 22 22:50:25 2016 +0000
+++ b/main.cpp	Mon Aug 22 23:14:42 2016 +0000
@@ -220,7 +220,7 @@
 // (pulled-up and two MCP23017 is configured with open drain INT)
 InterruptIn buttonInt(P0_5);
 
-Ticker ticker;
+// Ticker ticker;
 DigitalOut statusLed(P0_4, 1);
 
 
@@ -263,9 +263,6 @@
 	// DO NOT CONNECT RTS/CTS AUTOMATICALY!
 	NRF_UART0->PSELRTS = 0xFFFFFFFFUL;
 	NRF_UART0->PSELCTS = 0xFFFFFFFFUL;
-	
-	ticker.attach(tickerStatus, 1);
-
 
 	// 100kHz
 	i2c.frequency(100000);
@@ -284,7 +281,18 @@
 	NRF_TWI0->ENABLE = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos;
 	
 	
+	// ticker.attach(tickerStatus, 0.5);
 	while (1) {
+		/*
+		ticker.detach();
+		switch (HIDController::status()) {
+			case DISCONNECTED: ticker.attach(tickerStatus, 1); break;
+			case CONNECTING: ticker.attach(tickerStatus, 2); break;
+			case CONNECTED: ticker.attach(tickerStatus, 60);break;
+		}
+		*/
+		
+		
 		if (pollCount > 0) {
 			printf("scan keys\r\n");
 			while (pollCount -- > 0) {