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.
This commit is contained in:
tmk 2019-05-07 11:09:25 +09:00
parent 2fd396b8ca
commit d8e304e141

View file

@ -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();