From: tmk Date: Tue, 7 May 2019 02:09:25 +0000 (+0900) Subject: lufa: Startup and suspend loop can be disabled X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;ds=sidebyside;h=d8e304e141723f950ea610c1b3a3fe6f85a535e9;p=max%2Ftmk_keyboard.git 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. --- 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();