summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-04-20 18:52:15 +0700
committerhathach <[email protected]>2022-04-20 18:52:15 +0700
commit87572871d586856242c1fa44b1532a09e624162d (patch)
tree17f0c6d038ea9a73fdc78d94f15e50f2b3233b5c
parent6a022c73dbf1551a441fafbea3a27c1a9951816f (diff)
update example for better cdc echo
-rw-r--r--examples/device/cdc_msc_freertos/src/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/device/cdc_msc_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c
index 0492f2724..a5e907199 100644
--- a/examples/device/cdc_msc_freertos/src/main.c
+++ b/examples/device/cdc_msc_freertos/src/main.c
@@ -134,6 +134,7 @@ void usb_device_task(void* param)
tud_task();
// following code only run if tud_task() process at least 1 event
+ tud_cdc_write_flush();
}
}
@@ -183,7 +184,7 @@ void cdc_task(void* params)
// if ( tud_cdc_connected() )
{
// There are data available
- if ( tud_cdc_available() )
+ while ( tud_cdc_available() )
{
uint8_t buf[64];
@@ -196,8 +197,9 @@ 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();
}
+
+ tud_cdc_write_flush();
}
// For ESP32-Sx this delay is essential to allow idle how to run and reset watchdog