From 2d347c6595a5a264bbb446af2493e7a568bcf1cb Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Wed, 12 Feb 2025 02:36:34 +0200 Subject: [PATCH] Add support for two TinyUSB CDC devices at once --- components/arduino_tinyusb/Kconfig.projbuild | 8 ++++++++ components/arduino_tinyusb/include/tusb_config.h | 6 +++++- configs/defconfig.common | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/components/arduino_tinyusb/Kconfig.projbuild b/components/arduino_tinyusb/Kconfig.projbuild index 65d9c37be..f0a1b4dc6 100755 --- a/components/arduino_tinyusb/Kconfig.projbuild +++ b/components/arduino_tinyusb/Kconfig.projbuild @@ -42,6 +42,14 @@ menu "Arduino TinyUSB" help CDC FIFO size of TX + config TINYUSB_CDC_MAX_PORTS + int "Maximum enabled CDC ports" + range 1 2 + default 1 + depends on TINYUSB_CDC_ENABLED + help + Maximum enabled CDC ports + endmenu menu "Mass Storage (MSC) driver" diff --git a/components/arduino_tinyusb/include/tusb_config.h b/components/arduino_tinyusb/include/tusb_config.h index 458c78cf1..7802bea8f 100755 --- a/components/arduino_tinyusb/include/tusb_config.h +++ b/components/arduino_tinyusb/include/tusb_config.h @@ -115,7 +115,11 @@ extern "C" { #define CFG_TUD_ENDOINT0_SIZE 64 // Enabled Drivers -#define CFG_TUD_CDC CONFIG_TINYUSB_CDC_ENABLED +#ifdef CONFIG_TINYUSB_CDC_MAX_PORTS +#define CFG_TUD_CDC CONFIG_TINYUSB_CDC_MAX_PORTS +#else +#define CFG_TUD_CDC 0 +#endif #define CFG_TUD_MSC CONFIG_TINYUSB_MSC_ENABLED #define CFG_TUD_HID CONFIG_TINYUSB_HID_ENABLED #define CFG_TUD_MIDI CONFIG_TINYUSB_MIDI_ENABLED diff --git a/configs/defconfig.common b/configs/defconfig.common index ef4620bf6..bf5d1197f 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -131,3 +131,6 @@ CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n CONFIG_ENABLE_ESP_INSIGHTS_TRACE=n # Use compact attribute storage mode CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y + +#TinyUSB Config +CONFIG_TINYUSB_CDC_MAX_PORTS=2