Fix USB CDC on ESP32C3

Fix USB CDC on ESP32C3 (https://github.com/espressif/arduino-esp32/issues/6264)
This commit is contained in:
Theo Arends 2022-04-11 16:40:41 +02:00
parent 36bf6c5cc1
commit 500cc894b5

View File

@ -116,7 +116,18 @@ void WifiConfig(uint8_t type)
}
}
#ifdef CONFIG_IDF_TARGET_ESP32C3
// https://github.com/espressif/arduino-esp32/issues/6264#issuecomment-1040147331
// There's an include for this but it doesn't define the function if it doesn't think it needs it, so manually declare the function
extern "C" void phy_bbpll_en_usb(bool en);
#endif // CONFIG_IDF_TARGET_ESP32C3
void WifiSetMode(WiFiMode_t wifi_mode) {
#ifdef CONFIG_IDF_TARGET_ESP32C3
// https://github.com/espressif/arduino-esp32/issues/6264#issuecomment-1094376906
// This brings the USB serial-jtag back to life. Suggest doing this immediately after wifi startup.
phy_bbpll_en_usb(true);
#endif // CONFIG_IDF_TARGET_ESP32C3
if (WiFi.getMode() == wifi_mode) { return; }
if (wifi_mode != WIFI_OFF) {