diff options
| author | Ha Thach <[email protected]> | 2022-05-21 13:54:25 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-05-21 13:54:25 +0700 |
| commit | 2683deb0dd2e049de6c9b15f49d28a2fef4380f6 (patch) | |
| tree | fb480d7a4fa7aa7797097600b6d8a5fef3f080b3 /examples/device | |
| parent | 817227a850d4942cf48ede675325d635e2e7b3d5 (diff) | |
| parent | c2bcda86e2de35cc01628f4e909e2a7869a7322b (diff) | |
Merge branch 'master' into ch32v307
Diffstat (limited to 'examples/device')
| -rw-r--r-- | examples/device/cdc_msc_freertos/src/main.c | 14 | ||||
| -rw-r--r-- | examples/device/hid_boot_interface/src/tusb_config.h | 4 | ||||
| -rw-r--r-- | examples/device/hid_composite_freertos/src/main.c | 4 |
3 files changed, 16 insertions, 6 deletions
diff --git a/examples/device/cdc_msc_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c index 0a1c964ae..a5e907199 100644 --- a/examples/device/cdc_msc_freertos/src/main.c +++ b/examples/device/cdc_msc_freertos/src/main.c @@ -130,8 +130,11 @@ 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 + tud_cdc_write_flush(); } } @@ -181,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]; @@ -194,12 +197,13 @@ 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-S2 this delay is essential to allow idle how to run and reset wdt - vTaskDelay(pdMS_TO_TICKS(10)); + // For ESP32-Sx this delay is essential to allow idle how to run and reset watchdog + vTaskDelay(1); } } diff --git a/examples/device/hid_boot_interface/src/tusb_config.h b/examples/device/hid_boot_interface/src/tusb_config.h index 1c8fa40b2..8bc85b722 100644 --- a/examples/device/hid_boot_interface/src/tusb_config.h +++ b/examples/device/hid_boot_interface/src/tusb_config.h @@ -39,6 +39,10 @@ #error CFG_TUSB_MCU must be defined #endif +// Use raspberry pio-usb for device +// #define CFG_TUD_RPI_PIO_USB 1 +// #define BOARD_DEVICE_RHPORT_NUM 1 + // RHPort number used for device can be defined by board.mk, default to port 0 #ifndef BOARD_DEVICE_RHPORT_NUM #define BOARD_DEVICE_RHPORT_NUM 0 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 } } |
