Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0c4b35e

Browse files
me-no-devSuGlider
andauthoredMay 13, 2024
IDF release/v5.1 (espressif#9613)
* IDF release/v5.1 01b912a9e5 * Fix USB OTG Init on new IDF * Delete libraries/TFLiteMicro/examples/micro_speech directory Done in order to fix a CI problem created by an entire folder that was removed in original Library Repository. * IDF release/v5.1 442a798083 * Update esp32-hal-tinyusb.c --------- Co-authored-by: Rodrigo Garcia <[email protected]>
1 parent e10de73 commit 0c4b35e

21 files changed

+99
-2335
lines changed
 

‎CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ set(includedirs variants/${CONFIG_ARDUINO_VARIANT}/ cores/esp32/ ${ARDUINO_LIBRA
288288
set(srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS})
289289
set(priv_includes cores/esp32/libb64)
290290
set(requires spi_flash esp_partition mbedtls wifi_provisioning wpa_supplicant esp_adc esp_eth http_parser)
291-
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid ${ARDUINO_LIBRARIES_REQUIRES})
291+
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid usb ${ARDUINO_LIBRARIES_REQUIRES})
292292

293293
idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})
294294

‎cores/esp32/esp32-hal-tinyusb.c

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
#include "rom/gpio.h"
2424

25-
#include "hal/usb_hal.h"
2625
#include "hal/gpio_ll.h"
2726
#include "hal/clk_gate_ll.h"
2827

@@ -63,6 +62,10 @@ typedef struct {
6362
bool external_phy;
6463
} tinyusb_config_t;
6564

65+
#if __has_include("hal/usb_hal.h")
66+
67+
#include "hal/usb_hal.h"
68+
6669
static bool usb_otg_deinit(void *busptr) {
6770
// Once USB OTG is initialized, its GPIOs are assigned and it shall never be deinited
6871
// except when S3 swithicng usb from cdc to jtag while resetting to bootrom
@@ -101,10 +104,67 @@ static void configure_pins(usb_hal_context_t *usb) {
101104
}
102105
}
103106

104-
esp_err_t tinyusb_driver_install(const tinyusb_config_t *config) {
105-
usb_hal_context_t hal = {.use_external_phy = config->external_phy};
107+
esp_err_t init_usb_hal(bool external_phy) {
108+
usb_hal_context_t hal = {.use_external_phy = external_phy};
106109
usb_hal_init(&hal);
107110
configure_pins(&hal);
111+
return ESP_OK;
112+
}
113+
114+
esp_err_t deinit_usb_hal() {
115+
return ESP_OK;
116+
}
117+
118+
#elif __has_include("esp_private/usb_phy.h")
119+
120+
#include "esp_private/usb_phy.h"
121+
122+
static usb_phy_handle_t phy_handle = NULL;
123+
124+
esp_err_t init_usb_hal(bool external_phy) {
125+
esp_err_t ret = ESP_OK;
126+
usb_phy_config_t phy_config = {
127+
.controller = USB_PHY_CTRL_OTG,
128+
.target = USB_PHY_TARGET_INT,
129+
.otg_mode = USB_OTG_MODE_DEVICE,
130+
.otg_speed = USB_PHY_SPEED_FULL,
131+
.ext_io_conf = NULL,
132+
.otg_io_conf = NULL,
133+
};
134+
135+
ret = usb_new_phy(&phy_config, &phy_handle);
136+
if (ret != ESP_OK) {
137+
log_e("Failed to init USB PHY");
138+
}
139+
return ret;
140+
}
141+
142+
esp_err_t deinit_usb_hal() {
143+
esp_err_t ret = ESP_OK;
144+
if (phy_handle) {
145+
ret = usb_del_phy(phy_handle);
146+
if (ret != ESP_OK) {
147+
log_e("Failed to deinit USB PHY");
148+
}
149+
}
150+
return ret;
151+
}
152+
153+
#else
154+
155+
#error No way to initialize USP PHY
156+
157+
void init_usb_hal(bool external_phy) {
158+
return ESP_OK;
159+
}
160+
161+
void deinit_usb_hal() {
162+
return ESP_OK;
163+
}
164+
#endif
165+
166+
esp_err_t tinyusb_driver_install(const tinyusb_config_t *config) {
167+
init_usb_hal(config->external_phy);
108168
if (!tusb_init()) {
109169
log_e("Can't initialize the TinyUSB stack.");
110170
return ESP_FAIL;
@@ -420,6 +480,7 @@ static void hw_cdc_reset_handler(void *arg) {
420480

421481
static void usb_switch_to_cdc_jtag() {
422482
// Disable USB-OTG
483+
deinit_usb_hal();
423484
periph_ll_reset(PERIPH_USB_MODULE);
424485
//periph_ll_enable_clk_clear_rst(PERIPH_USB_MODULE);
425486
periph_ll_disable_clk_set_rst(PERIPH_USB_MODULE);

‎libraries/TFLiteMicro/examples/micro_speech/README.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/audio_provider.cpp

Lines changed: 0 additions & 184 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/audio_provider.h

Lines changed: 0 additions & 43 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/command_responder.cpp

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/command_responder.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/feature_provider.cpp

Lines changed: 0 additions & 105 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/feature_provider.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/micro_features_generator.cpp

Lines changed: 0 additions & 110 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/micro_features_generator.h

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/micro_model_settings.cpp

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/micro_model_settings.h

Lines changed: 0 additions & 43 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/micro_speech.ino

Lines changed: 0 additions & 158 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/model.cpp

Lines changed: 0 additions & 757 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/model.h

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/recognize_commands.cpp

Lines changed: 0 additions & 121 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/recognize_commands.h

Lines changed: 0 additions & 154 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/ringbuf.c

Lines changed: 0 additions & 333 deletions
This file was deleted.

‎libraries/TFLiteMicro/examples/micro_speech/ringbuf.h

Lines changed: 0 additions & 85 deletions
This file was deleted.

‎package/package_esp32_index.template.json

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
{
4343
"packager": "esp32",
4444
"name": "esp32-arduino-libs",
45-
"version": "idf-release_v5.1-d06c758489"
45+
"version": "idf-release_v5.1-442a798083"
4646
},
4747
{
4848
"packager": "esp32",
@@ -105,63 +105,63 @@
105105
"tools": [
106106
{
107107
"name": "esp32-arduino-libs",
108-
"version": "idf-release_v5.1-d06c758489",
108+
"version": "idf-release_v5.1-442a798083",
109109
"systems": [
110110
{
111111
"host": "i686-mingw32",
112-
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/07d6415e1df493c23a3091761be59ece49527313",
113-
"archiveFileName": "esp32-arduino-libs-07d6415e1df493c23a3091761be59ece49527313.zip",
114-
"checksum": "SHA-256:9d47ec1df5b217ce4e163f116dbff7b718d1ca87914725731455eae786add447",
115-
"size": "371892775"
112+
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/951ade74d7886e1ce931ea46614c4ac47ae3a6c0",
113+
"archiveFileName": "esp32-arduino-libs-951ade74d7886e1ce931ea46614c4ac47ae3a6c0.zip",
114+
"checksum": "SHA-256:ac9e200eac443655c5661a4a9251032cb08a7d7a4e32c34ebeb8d340f0030aab",
115+
"size": "375249835"
116116
},
117117
{
118118
"host": "x86_64-mingw32",
119-
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/07d6415e1df493c23a3091761be59ece49527313",
120-
"archiveFileName": "esp32-arduino-libs-07d6415e1df493c23a3091761be59ece49527313.zip",
121-
"checksum": "SHA-256:9d47ec1df5b217ce4e163f116dbff7b718d1ca87914725731455eae786add447",
122-
"size": "371892775"
119+
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/951ade74d7886e1ce931ea46614c4ac47ae3a6c0",
120+
"archiveFileName": "esp32-arduino-libs-951ade74d7886e1ce931ea46614c4ac47ae3a6c0.zip",
121+
"checksum": "SHA-256:ac9e200eac443655c5661a4a9251032cb08a7d7a4e32c34ebeb8d340f0030aab",
122+
"size": "375249835"
123123
},
124124
{
125125
"host": "arm64-apple-darwin",
126-
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/07d6415e1df493c23a3091761be59ece49527313",
127-
"archiveFileName": "esp32-arduino-libs-07d6415e1df493c23a3091761be59ece49527313.zip",
128-
"checksum": "SHA-256:9d47ec1df5b217ce4e163f116dbff7b718d1ca87914725731455eae786add447",
129-
"size": "371892775"
126+
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/951ade74d7886e1ce931ea46614c4ac47ae3a6c0",
127+
"archiveFileName": "esp32-arduino-libs-951ade74d7886e1ce931ea46614c4ac47ae3a6c0.zip",
128+
"checksum": "SHA-256:ac9e200eac443655c5661a4a9251032cb08a7d7a4e32c34ebeb8d340f0030aab",
129+
"size": "375249835"
130130
},
131131
{
132132
"host": "x86_64-apple-darwin",
133-
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/07d6415e1df493c23a3091761be59ece49527313",
134-
"archiveFileName": "esp32-arduino-libs-07d6415e1df493c23a3091761be59ece49527313.zip",
135-
"checksum": "SHA-256:9d47ec1df5b217ce4e163f116dbff7b718d1ca87914725731455eae786add447",
136-
"size": "371892775"
133+
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/951ade74d7886e1ce931ea46614c4ac47ae3a6c0",
134+
"archiveFileName": "esp32-arduino-libs-951ade74d7886e1ce931ea46614c4ac47ae3a6c0.zip",
135+
"checksum": "SHA-256:ac9e200eac443655c5661a4a9251032cb08a7d7a4e32c34ebeb8d340f0030aab",
136+
"size": "375249835"
137137
},
138138
{
139139
"host": "x86_64-pc-linux-gnu",
140-
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/07d6415e1df493c23a3091761be59ece49527313",
141-
"archiveFileName": "esp32-arduino-libs-07d6415e1df493c23a3091761be59ece49527313.zip",
142-
"checksum": "SHA-256:9d47ec1df5b217ce4e163f116dbff7b718d1ca87914725731455eae786add447",
143-
"size": "371892775"
140+
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/951ade74d7886e1ce931ea46614c4ac47ae3a6c0",
141+
"archiveFileName": "esp32-arduino-libs-951ade74d7886e1ce931ea46614c4ac47ae3a6c0.zip",
142+
"checksum": "SHA-256:ac9e200eac443655c5661a4a9251032cb08a7d7a4e32c34ebeb8d340f0030aab",
143+
"size": "375249835"
144144
},
145145
{
146146
"host": "i686-pc-linux-gnu",
147-
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/07d6415e1df493c23a3091761be59ece49527313",
148-
"archiveFileName": "esp32-arduino-libs-07d6415e1df493c23a3091761be59ece49527313.zip",
149-
"checksum": "SHA-256:9d47ec1df5b217ce4e163f116dbff7b718d1ca87914725731455eae786add447",
150-
"size": "371892775"
147+
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/951ade74d7886e1ce931ea46614c4ac47ae3a6c0",
148+
"archiveFileName": "esp32-arduino-libs-951ade74d7886e1ce931ea46614c4ac47ae3a6c0.zip",
149+
"checksum": "SHA-256:ac9e200eac443655c5661a4a9251032cb08a7d7a4e32c34ebeb8d340f0030aab",
150+
"size": "375249835"
151151
},
152152
{
153153
"host": "aarch64-linux-gnu",
154-
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/07d6415e1df493c23a3091761be59ece49527313",
155-
"archiveFileName": "esp32-arduino-libs-07d6415e1df493c23a3091761be59ece49527313.zip",
156-
"checksum": "SHA-256:9d47ec1df5b217ce4e163f116dbff7b718d1ca87914725731455eae786add447",
157-
"size": "371892775"
154+
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/951ade74d7886e1ce931ea46614c4ac47ae3a6c0",
155+
"archiveFileName": "esp32-arduino-libs-951ade74d7886e1ce931ea46614c4ac47ae3a6c0.zip",
156+
"checksum": "SHA-256:ac9e200eac443655c5661a4a9251032cb08a7d7a4e32c34ebeb8d340f0030aab",
157+
"size": "375249835"
158158
},
159159
{
160160
"host": "arm-linux-gnueabihf",
161-
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/07d6415e1df493c23a3091761be59ece49527313",
162-
"archiveFileName": "esp32-arduino-libs-07d6415e1df493c23a3091761be59ece49527313.zip",
163-
"checksum": "SHA-256:9d47ec1df5b217ce4e163f116dbff7b718d1ca87914725731455eae786add447",
164-
"size": "371892775"
161+
"url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/951ade74d7886e1ce931ea46614c4ac47ae3a6c0",
162+
"archiveFileName": "esp32-arduino-libs-951ade74d7886e1ce931ea46614c4ac47ae3a6c0.zip",
163+
"checksum": "SHA-256:ac9e200eac443655c5661a4a9251032cb08a7d7a4e32c34ebeb8d340f0030aab",
164+
"size": "375249835"
165165
}
166166
]
167167
},

0 commit comments

Comments
 (0)
Please sign in to comment.