diff options
| author | Joel Challis <[email protected]> | 2025-04-22 05:31:42 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-22 14:31:42 +1000 |
| commit | b5f8f4d6a201e6a67d1ee483fe6d3327d98cb052 (patch) | |
| tree | efafcc934c9bd917eeca98bc26bd5209e81928e1 | |
| parent | 0c4124c1c03dc610cb192f21889faabd99d25b75 (diff) | |
| download | qmk_firmware-b5f8f4d6a201e6a67d1ee483fe6d3327d98cb052.tar.gz qmk_firmware-b5f8f4d6a201e6a67d1ee483fe6d3327d98cb052.zip | |
Align ChibiOS `USB_WAIT_FOR_ENUMERATION` implementation (#25184)
| -rw-r--r-- | tmk_core/protocol/chibios/chibios.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c index cf948154f9..d752f3746b 100644 --- a/tmk_core/protocol/chibios/chibios.c +++ b/tmk_core/protocol/chibios/chibios.c @@ -134,8 +134,6 @@ void protocol_setup(void) { // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); } -static host_driver_t *driver = NULL; - void protocol_pre_init(void) { /* Init USB */ usb_event_queue_init(); @@ -146,18 +144,11 @@ void protocol_pre_init(void) { #endif /* Wait until USB is active */ - while (true) { -#if defined(USB_WAIT_FOR_ENUMERATION) - if (USB_DRIVER.state == USB_ACTIVE) { - driver = &chibios_driver; - break; - } -#else - driver = &chibios_driver; - break; -#endif +#ifdef USB_WAIT_FOR_ENUMERATION + while (USB_DRIVER.state != USB_ACTIVE) { wait_ms(50); } +#endif /* Do need to wait here! * Otherwise the next print might start a transfer on console EP @@ -170,7 +161,7 @@ void protocol_pre_init(void) { } void protocol_post_init(void) { - host_set_driver(driver); + host_set_driver(&chibios_driver); } void protocol_pre_task(void) { |
