|
|
@@ -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) {
|