Update chibios.c

This commit is contained in:
lalalademaxiya1 2023-10-23 10:15:58 +08:00
parent de124f6f25
commit 944aa4a88e

View File

@ -179,35 +179,10 @@ void protocol_post_init(void) {
host_set_driver(driver); host_set_driver(driver);
} }
#if defined(STM32_USB_USE_OTG1)
void protocol_pre_task(void) {
# if !defined(NO_USB_STARTUP_CHECK)
if (USB_DRIVER.state == USB_SUSPENDED) {
dprintln("suspending keyboard");
while (USB_DRIVER.state == USB_SUSPENDED) {
/* Do this in the suspended state */
suspend_power_down(); // on AVR this deep sleeps for 15ms
/* Remote wakeup */
if ((USB_DRIVER.status & USB_GETSTATUS_REMOTE_WAKEUP_ENABLED) && suspend_wakeup_condition()) {
usbWakeupHost(&USB_DRIVER);
wait_ms(300);
}
}
/* Woken up */
// variables has been already cleared by the wakeup hook
send_keyboard_report();
# ifdef MOUSEKEY_ENABLE
mousekey_send();
# endif /* MOUSEKEY_ENABLE */
}
# endif
usb_event_queue_task();
}
#else
void protocol_pre_task(void) { void protocol_pre_task(void) {
usb_event_queue_task(); usb_event_queue_task();
# if !defined(NO_USB_STARTUP_CHECK) #if !defined(NO_USB_STARTUP_CHECK)
if (USB_DRIVER.state == USB_SUSPENDED) { if (USB_DRIVER.state == USB_SUSPENDED) {
dprintln("suspending keyboard"); dprintln("suspending keyboard");
while (USB_DRIVER.state == USB_SUSPENDED) { while (USB_DRIVER.state == USB_SUSPENDED) {
@ -222,13 +197,12 @@ void protocol_pre_task(void) {
/* Woken up */ /* Woken up */
// variables has been already cleared by the wakeup hook // variables has been already cleared by the wakeup hook
send_keyboard_report(); send_keyboard_report();
# ifdef MOUSEKEY_ENABLE # ifdef MOUSEKEY_ENABLE
mousekey_send(); mousekey_send();
# endif /* MOUSEKEY_ENABLE */ # endif /* MOUSEKEY_ENABLE */
} }
# endif
}
#endif #endif
}
void protocol_post_task(void) { void protocol_post_task(void) {
#ifdef CONSOLE_ENABLE #ifdef CONSOLE_ENABLE