mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
added tud_task_event_ready()
to check if there is pending events in the tud task without executing it. Useful to check before entering low power mode with WFI/WFE
This commit is contained in:
parent
4e8d414bc6
commit
88a455a9b9
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user