Hiroh Satoh / keyboard Featured

Dependencies:   BLE_API mbed-dev nRF51822

Revision:
45:f4be69c936f6
Parent:
43:4de3870b39cb
Child:
47:5bf2ae8cc710
--- a/main.cpp	Sat Aug 27 17:58:45 2016 +0900
+++ b/main.cpp	Sun Aug 28 14:32:28 2016 +0000
@@ -255,7 +255,7 @@
 				// use timer1 to use wait 5ms
 				timeout.attach_us(wakeupKeyIntervalSleep, 5000);
 				keyIntervalInterrupt = false;
-				while (!keyIntervalInterrupt) sleep();
+				while (!keyIntervalInterrupt) HIDController::waitForEvent();
 			}
 		} else {
 			if (!updateStatudLedEnabled) updateStatusLed();
@@ -276,6 +276,10 @@
 			if (isLowBattery) {
 				powerOff();
 			}
+			
+			if (HIDController::status() == DISCONNECTED) {
+				HIDController::initializeConnection(false);
+			}
 
 			if (DEBUG_BLE_INTERRUPT) {
 				HIDController::waitForEvent();