From 2d92274ac4f4d33d8e2adf7b8cc39aabe3e2fb09 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Mon, 3 Jun 2024 13:20:29 +0300 Subject: [PATCH 1/2] feat(usb): Support the new USB IDF API Required for the latest ESP-IDF release/v5.1 --- cores/esp32/esp32-hal-tinyusb.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cores/esp32/esp32-hal-tinyusb.c b/cores/esp32/esp32-hal-tinyusb.c index c6ad7460ac4..69f3b6ebd43 100644 --- a/cores/esp32/esp32-hal-tinyusb.c +++ b/cores/esp32/esp32-hal-tinyusb.c @@ -43,7 +43,7 @@ #elif CONFIG_IDF_TARGET_ESP32S3 #if defined __has_include && __has_include("hal/usb_phy_ll.h") #include "hal/usb_phy_ll.h" -#else +#elif defined __has_include && __has_include("hal/usb_fsls_phy_ll.h") #include "hal/usb_fsls_phy_ll.h" #endif #include "hal/usb_serial_jtag_ll.h" @@ -503,8 +503,18 @@ static void usb_switch_to_cdc_jtag() { // Initialize CDC+JTAG ISR to listen for BUS_RESET #if defined __has_include && __has_include("hal/usb_phy_ll.h") usb_phy_ll_int_jtag_enable(&USB_SERIAL_JTAG); -#else +#elif defined __has_include && __has_include("hal/usb_fsls_phy_ll.h") usb_fsls_phy_ll_int_jtag_enable(&USB_SERIAL_JTAG); +#else + // usb_serial_jtag_ll_phy_set_defaults(); + const usb_serial_jtag_pull_override_vals_t pull_conf = { + .dp_pu = 1, + .dm_pu = 0, + .dp_pd = 0, + .dm_pd = 0 + }; + usb_serial_jtag_ll_phy_enable_pull_override(&pull_conf); + usb_serial_jtag_ll_phy_disable_pull_override(); #endif usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_LL_INTR_MASK); usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_LL_INTR_MASK); From 32c95e80e1c6fd73d626d8b0d7724d3e16e40584 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:52:09 +0000 Subject: [PATCH 2/2] ci(pre-commit): Apply automatic fixes --- cores/esp32/esp32-hal-tinyusb.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cores/esp32/esp32-hal-tinyusb.c b/cores/esp32/esp32-hal-tinyusb.c index 69f3b6ebd43..4b39da82641 100644 --- a/cores/esp32/esp32-hal-tinyusb.c +++ b/cores/esp32/esp32-hal-tinyusb.c @@ -507,12 +507,7 @@ static void usb_switch_to_cdc_jtag() { usb_fsls_phy_ll_int_jtag_enable(&USB_SERIAL_JTAG); #else // usb_serial_jtag_ll_phy_set_defaults(); - const usb_serial_jtag_pull_override_vals_t pull_conf = { - .dp_pu = 1, - .dm_pu = 0, - .dp_pd = 0, - .dm_pd = 0 - }; + const usb_serial_jtag_pull_override_vals_t pull_conf = {.dp_pu = 1, .dm_pu = 0, .dp_pd = 0, .dm_pd = 0}; usb_serial_jtag_ll_phy_enable_pull_override(&pull_conf); usb_serial_jtag_ll_phy_disable_pull_override(); #endif