summaryrefslogtreecommitdiff
path: root/protocol/lufa/lufa.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2014-11-24 15:36:53 +0900
committertmk <nobody@nowhere>2014-11-24 15:36:53 +0900
commited52ebb9870a26496b13a0565c1aaca8ded3465b (patch)
treecddad806a3408e05bc29310254c564ee94e3e710 /protocol/lufa/lufa.c
parenteb90ed6238426db9367e294abfaefb5de07564f5 (diff)
parente2077cad45f1736e878e317c43bd94117c61b5e0 (diff)
downloadqmk_firmware-ed52ebb9870a26496b13a0565c1aaca8ded3465b.tar.gz
qmk_firmware-ed52ebb9870a26496b13a0565c1aaca8ded3465b.zip
Merge branch 'merge_rn42'
Diffstat (limited to 'protocol/lufa/lufa.c')
-rw-r--r--protocol/lufa/lufa.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c
index 16a602df13..6802f3b631 100644
--- a/protocol/lufa/lufa.c
+++ b/protocol/lufa/lufa.c
@@ -148,10 +148,23 @@ static void Console_Task(void)
*/
void EVENT_USB_Device_Connect(void)
{
+ /* For battery powered device */
+ if (!USB_IsInitialized) {
+ USB_Init();
+ USB_Device_EnableSOFEvents();
+ }
}
void EVENT_USB_Device_Disconnect(void)
{
+ /* For battery powered device */
+/* TODO: This doesn't work. After several plug in/outs can not be enumerated.
+ if (USB_IsInitialized) {
+ USB_Disable(); // Disable all interrupts
+ USB_Controller_Enable();
+ USB_INT_Enable(USB_INT_VBUSTI);
+ }
+*/
}
void EVENT_USB_Device_Reset(void)
@@ -574,7 +587,7 @@ int main(void)
print("Keyboard start.\n");
while (1) {
while (USB_DeviceState == DEVICE_STATE_Suspended) {
- suspend_power_down();
+ suspend_power_down(WDTO_120MS);
if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) {
USB_Device_SendRemoteWakeup();
}