From 06823878a81d5e5d3a0001e0e398e501b1fd3f64 Mon Sep 17 00:00:00 2001 From: Roman Leonov Date: Fri, 26 Jan 2024 11:10:27 +0100 Subject: [PATCH] fix(esp_tinyusb): Fixed CDC redef warn for MIN(), EP bulk size for MSC default config --- device/esp_tinyusb/CHANGELOG.md | 6 ++++++ device/esp_tinyusb/tusb_cdc_acm.c | 2 ++ device/esp_tinyusb/usb_descriptors.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/device/esp_tinyusb/CHANGELOG.md b/device/esp_tinyusb/CHANGELOG.md index b64f887e..8138f07e 100644 --- a/device/esp_tinyusb/CHANGELOG.md +++ b/device/esp_tinyusb/CHANGELOG.md @@ -1,4 +1,10 @@ +## 1.4.4 (Unreleased) + +- CDC-ACM: Remove MIN() definition if already defined +- MSC: Set EP size in configuration descriptor based on speed + ## 1.4.3 + - esp_tinyusb: ESP32P4 HS only support ## 1.4.2 diff --git a/device/esp_tinyusb/tusb_cdc_acm.c b/device/esp_tinyusb/tusb_cdc_acm.c index 83fd3304..a69ba6e2 100644 --- a/device/esp_tinyusb/tusb_cdc_acm.c +++ b/device/esp_tinyusb/tusb_cdc_acm.c @@ -15,7 +15,9 @@ #include "cdc.h" #include "sdkconfig.h" +#ifndef MIN #define MIN(x, y) (((x) < (y)) ? (x) : (y)) +#endif // CDC-ACM spinlock static portMUX_TYPE cdc_acm_lock = portMUX_INITIALIZER_UNLOCKED; diff --git a/device/esp_tinyusb/usb_descriptors.c b/device/esp_tinyusb/usb_descriptors.c index 1c6e1ce5..956cc0fb 100644 --- a/device/esp_tinyusb/usb_descriptors.c +++ b/device/esp_tinyusb/usb_descriptors.c @@ -182,7 +182,7 @@ uint8_t const descriptor_cfg_kconfig[] = { #if CFG_TUD_MSC // Interface number, string index, EP Out & EP In address, EP size - TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, STRID_MSC_INTERFACE, EPNUM_MSC, 0x80 | EPNUM_MSC, 64), // highspeed 512 + TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, STRID_MSC_INTERFACE, EPNUM_MSC, 0x80 | EPNUM_MSC, TUD_OPT_HIGH_SPEED ? 512 : 64), #endif #if CFG_TUD_NCM