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.
keyboard_init();
+#ifndef NO_USB_STARTUP_WAIT_LOOP
/* wait for USB startup */
while (USB_DeviceState != DEVICE_STATE_Configured) {
#if defined(INTERRUPT_CONTROL_ENDPOINT)
#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();