mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-26 17:37:05 +00:00
add tusb_inited() API, check for inited() before running device/host task
This commit is contained in:
parent
777f41a066
commit
e4e8413acc
@ -240,6 +240,9 @@ static void usbd_reset(uint8_t rhport)
|
||||
*/
|
||||
void tud_task (void)
|
||||
{
|
||||
// Skip if stack is not initialized
|
||||
if ( !tusb_inited() ) return;
|
||||
|
||||
// Loop until there is no more events in the queue
|
||||
while (1)
|
||||
{
|
||||
|
@ -620,6 +620,9 @@ bool enum_task(hcd_event_t* event)
|
||||
*/
|
||||
void tuh_task(void)
|
||||
{
|
||||
// Skip if stack is not initialized
|
||||
if ( !tusb_inited() ) return;
|
||||
|
||||
// Loop until there is no more events in the queue
|
||||
while (1)
|
||||
{
|
||||
|
@ -68,6 +68,11 @@ bool tusb_init(void)
|
||||
return TUSB_ERROR_NONE;
|
||||
}
|
||||
|
||||
bool tusb_inited(void)
|
||||
{
|
||||
return _initialized;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Debug
|
||||
*------------------------------------------------------------------*/
|
||||
|
@ -108,6 +108,9 @@
|
||||
// Initialize device/host stack
|
||||
bool tusb_init(void);
|
||||
|
||||
// Check if stack is initialized
|
||||
bool tusb_inited(void);
|
||||
|
||||
// TODO
|
||||
// bool tusb_teardown(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user