summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
Diffstat (limited to 'src/device')
-rw-r--r--src/device/usbd.c8
-rw-r--r--src/device/usbd.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 06e724cb3..f7918c07e 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -339,6 +339,14 @@ static void usbd_reset(uint8_t rhport)
}
}
+bool tud_task_event_ready(void)
+{
+ // Skip if stack is not initialized
+ if ( !tusb_inited() ) return false;
+
+ return !osal_queue_empty(_usbd_q);
+}
+
/* USB Device Driver task
* This top level thread manages all device controller event and delegates events to class-specific drivers.
* This should be called periodically within the mainloop or rtos thread.
diff --git a/src/device/usbd.h b/src/device/usbd.h
index 713bee2b2..ecef63e18 100644
--- a/src/device/usbd.h
+++ b/src/device/usbd.h
@@ -47,6 +47,9 @@ bool tud_init (void);
// Task function should be called in main/rtos loop
void tud_task (void);
+// Check if there is pending events need proccessing by tud_task()
+bool tud_task_event_ready(void);
+
// Interrupt handler, name alias to DCD
#define tud_int_handler dcd_int_handler