summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-04-20 18:35:38 +0700
committerhathach <[email protected]>2022-04-20 18:35:38 +0700
commit6a022c73dbf1551a441fafbea3a27c1a9951816f (patch)
tree716818ba62ac63bed1fa622387bf87d02ca615ad /examples
parentb034c18077ef1350f2678f245ed1b885e9be79fc (diff)
add note for tud_task() behavior in freertos example
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc_freertos/src/main.c5
-rw-r--r--examples/device/hid_composite_freertos/src/main.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/examples/device/cdc_msc_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c
index 0d40782ef..0492f2724 100644
--- a/examples/device/cdc_msc_freertos/src/main.c
+++ b/examples/device/cdc_msc_freertos/src/main.c
@@ -130,10 +130,10 @@ void usb_device_task(void* param)
// RTOS forever loop
while (1)
{
- // tinyusb device task
+ // put this thread to waiting state until there is new events
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
// $ dd if=/dev/zero of=/dev/ttyACM0 count=10000
tud_cdc_write(buf, count);
+ tud_cdc_write_flush();
}
}
diff --git a/examples/device/hid_composite_freertos/src/main.c b/examples/device/hid_composite_freertos/src/main.c
index 1695f968c..317b64611 100644
--- a/examples/device/hid_composite_freertos/src/main.c
+++ b/examples/device/hid_composite_freertos/src/main.c
@@ -132,8 +132,10 @@ void usb_device_task(void* param)
// RTOS forever loop
while (1)
{
- // tinyusb device task
+ // put this thread to waiting state until there is new events
tud_task();
+
+ // following code only run if tud_task() process at least 1 event
}
}