From d8e304e141723f950ea610c1b3a3fe6f85a535e9 Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 7 May 2019 11:09:25 +0900 Subject: [PATCH] lufa: Startup and suspend loop can be disabled Startup wait loop is originally intended to start keyboard task loop and after console output endpoint becomes available. But now that console output is buffered when it is not available and you don't have to wait for it to be ready. You can disable the startup wait loop by defining NO_WAIT_FOR_USB_CONFIGURED in config.h Suspend loop is used for power saving by making tasks stop while USB bus is under suspend status. But this may cause problem on some devices like converter that must keep doing its task to retain communication with keyboard. The suspend loop can block its task for around 15-17ms. You can disable the suspend loop by defining NO_USB_SUSPEND_LOOP in config.h. --- tmk_core/protocol/lufa/lufa.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index aecaa050..ce15ec73 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -654,6 +654,7 @@ int main(void) keyboard_init(); +#ifndef NO_USB_STARTUP_WAIT_LOOP /* wait for USB startup */ while (USB_DeviceState != DEVICE_STATE_Configured) { #if defined(INTERRUPT_CONTROL_ENDPOINT) @@ -663,14 +664,17 @@ int main(void) #endif } print("\nUSB configured.\n"); +#endif hook_late_init(); print("\nKeyboard start.\n"); while (1) { +#ifndef NO_USB_SUSPEND_LOOP while (USB_DeviceState == DEVICE_STATE_Suspended) { hook_usb_suspend_loop(); } +#endif keyboard_task(); -- 2.45.2