summaryrefslogtreecommitdiff
path: root/tmk_core/protocol
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2025-04-22 05:31:42 +0100
committerGitHub <noreply@github.com>2025-04-22 14:31:42 +1000
commitb5f8f4d6a201e6a67d1ee483fe6d3327d98cb052 (patch)
treeefafcc934c9bd917eeca98bc26bd5209e81928e1 /tmk_core/protocol
parent0c4124c1c03dc610cb192f21889faabd99d25b75 (diff)
Align ChibiOS `USB_WAIT_FOR_ENUMERATION` implementation (#25184)
Diffstat (limited to 'tmk_core/protocol')
-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) {
134 // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); 134 // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
135} 135}
136 136
137static host_driver_t *driver = NULL;
138
139void protocol_pre_init(void) { 137void protocol_pre_init(void) {
140 /* Init USB */ 138 /* Init USB */
141 usb_event_queue_init(); 139 usb_event_queue_init();
@@ -146,18 +144,11 @@ void protocol_pre_init(void) {
146#endif 144#endif
147 145
148 /* Wait until USB is active */ 146 /* Wait until USB is active */
149 while (true) { 147#ifdef USB_WAIT_FOR_ENUMERATION
150#if defined(USB_WAIT_FOR_ENUMERATION) 148 while (USB_DRIVER.state != USB_ACTIVE) {
151 if (USB_DRIVER.state == USB_ACTIVE) {
152 driver = &chibios_driver;
153 break;
154 }
155#else
156 driver = &chibios_driver;
157 break;
158#endif
159 wait_ms(50); 149 wait_ms(50);
160 } 150 }
151#endif
161 152
162 /* Do need to wait here! 153 /* Do need to wait here!
163 * Otherwise the next print might start a transfer on console EP 154 * Otherwise the next print might start a transfer on console EP
@@ -170,7 +161,7 @@ void protocol_pre_init(void) {
170} 161}
171 162
172void protocol_post_init(void) { 163void protocol_post_init(void) {
173 host_set_driver(driver); 164 host_set_driver(&chibios_driver);
174} 165}
175 166
176void protocol_pre_task(void) { 167void protocol_pre_task(void) {