Skip to content

Commit a7680c0

Browse files
committed
shared/tinyusb: Wake main task if needed at end of USB ISR.
Signed-off-by: Andrew Leech <[email protected]>
1 parent adaa79a commit a7680c0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

shared/tinyusb/mp_usbd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ void mp_usbd_task_callback(mp_sched_node_t *node) {
4949

5050
extern void __real_dcd_event_handler(dcd_event_t const *event, bool in_isr);
5151

52+
// Provide stub for ports that don't have/need the wake main task function.
53+
void __attribute((weak)) mp_hal_wake_main_task_from_isr(void) {
54+
}
55+
5256
// If -Wl,--wrap=dcd_event_handler is passed to the linker, then this wrapper
5357
// will be called and allows MicroPython to schedule the TinyUSB task when
5458
// dcd_event_handler() is called from an ISR.
5559
TU_ATTR_FAST_FUNC void __wrap_dcd_event_handler(dcd_event_t const *event, bool in_isr) {
5660
__real_dcd_event_handler(event, in_isr);
5761
mp_usbd_schedule_task();
62+
mp_hal_wake_main_task_from_isr();
5863
}
5964

6065
TU_ATTR_FAST_FUNC void mp_usbd_schedule_task(void) {

0 commit comments

Comments
 (0)