add note for tud_task() behavior in freertos example

This commit is contained in:
hathach 2022-04-20 18:35:38 +07:00
parent b034c18077
commit 6a022c73db
No known key found for this signature in database
GPG Key ID: F5D50C6D51D17CBA
4 changed files with 8 additions and 5 deletions

View File

@ -130,10 +130,10 @@ void usb_device_task(void* param)
// RTOS forever loop // RTOS forever loop
while (1) while (1)
{ {
// tinyusb device task // put this thread to waiting state until there is new events
tud_task(); tud_task();
tud_cdc_write_flush(); // following code only run if tud_task() process at least 1 event
} }
} }
@ -196,6 +196,7 @@ void cdc_task(void* params)
// for throughput test e.g // for throughput test e.g
// $ dd if=/dev/zero of=/dev/ttyACM0 count=10000 // $ dd if=/dev/zero of=/dev/ttyACM0 count=10000
tud_cdc_write(buf, count); tud_cdc_write(buf, count);
tud_cdc_write_flush();
} }
} }

View File

@ -132,8 +132,10 @@ void usb_device_task(void* param)
// RTOS forever loop // RTOS forever loop
while (1) while (1)
{ {
// tinyusb device task // put this thread to waiting state until there is new events
tud_task(); tud_task();
// following code only run if tud_task() process at least 1 event
} }
} }

View File

@ -52,7 +52,7 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr);
TU_ATTR_ALWAYS_INLINE static inline TU_ATTR_ALWAYS_INLINE static inline
void tud_task (void) void tud_task (void)
{ {
tud_task_ext(OSAL_TIMEOUT_WAIT_FOREVER, false); tud_task_ext(UINT32_MAX, false);
} }
// Check if there is pending events need proccessing by tud_task() // Check if there is pending events need proccessing by tud_task()

View File

@ -100,7 +100,7 @@ void tuh_task_ext(uint32_t timeout_ms, bool in_isr);
TU_ATTR_ALWAYS_INLINE static inline TU_ATTR_ALWAYS_INLINE static inline
void tuh_task(void) void tuh_task(void)
{ {
tuh_task_ext(OSAL_TIMEOUT_WAIT_FOREVER, false); tuh_task_ext(UINT32_MAX, false);
} }
// Interrupt handler, name alias to HCD // Interrupt handler, name alias to HCD