aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/protocol/chibios/chibios.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/chibios/chibios.c')
-rw-r--r--tmk_core/protocol/chibios/chibios.c17
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) {