summaryrefslogtreecommitdiff
path: root/ports/esp32/usb.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-05-09 09:52:54 +1000
committerDamien George <damien@micropython.org>2023-06-23 15:34:22 +1000
commite4650125b88a35f074097f16d84a8f49bd22ac06 (patch)
tree6b87f056d0c23f2eb043fa2da0f949429af50e94 /ports/esp32/usb.c
parent2af229c3cc55ceefc4cfba0f50092af725c3bfa9 (diff)
esp32: Update port to support IDF v5.0.2.
This commit updates the esp32 port to work exclusively with ESP-IDF v5. IDF v5 is needed for some of the newer ESP32 SoCs to work, and it also cleans up a lot of the inconsistencies between existing SoCs (eg S2, S3, and C3). Support for IDF v4 is dropped because it's a lot of effort to maintain both versions at the same time. The following components have been verified to work on the various SoCs: ESP32 ESP32-S2 ESP32-S3 ESP32-C3 build pass pass pass pass SPIRAM pass pass pass N/A REPL (UART) pass pass pass pass REPL (USB) N/A pass pass N/A filesystem pass pass pass pass GPIO pass pass pass pass SPI pass pass pass pass I2C pass pass pass pass PWM pass pass pass pass ADC pass pass pass pass WiFi STA pass pass pass pass WiFi AP pass pass pass pass BLE pass N/A pass pass ETH pass -- -- -- PPP pass pass pass -- sockets pass pass pass pass SSL pass ENOMEM pass pass RMT pass pass pass pass NeoPixel pass pass pass pass I2S pass pass pass N/A ESPNow pass pass pass pass ULP-FSM pass pass pass N/A SDCard pass N/A N/A pass WDT pass pass pass pass Signed-off-by: Damien George <damien@micropython.org> Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'ports/esp32/usb.c')
-rw-r--r--ports/esp32/usb.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ports/esp32/usb.c b/ports/esp32/usb.c
index 80612cd27..83ba9533d 100644
--- a/ports/esp32/usb.c
+++ b/ports/esp32/usb.c
@@ -28,14 +28,17 @@
#include "py/mphal.h"
#include "usb.h"
-#if CONFIG_USB_ENABLED
+#if CONFIG_USB_OTG_SUPPORTED
+#include "esp_timer.h"
+#ifndef NO_QSTR
#include "tinyusb.h"
#include "tusb_cdc_acm.h"
+#endif
#define CDC_ITF TINYUSB_CDC_ACM_0
-static uint8_t usb_rx_buf[CONFIG_USB_CDC_RX_BUFSIZE];
+static uint8_t usb_rx_buf[CONFIG_TINYUSB_CDC_RX_BUFSIZE];
static void usb_callback_rx(int itf, cdcacm_event_t *event) {
// TODO: what happens if more chars come in during this function, are they lost?
@@ -79,7 +82,7 @@ void usb_init(void) {
void usb_tx_strn(const char *str, size_t len) {
// Write out the data to the CDC interface, but only while the USB host is connected.
- uint64_t timeout = esp_timer_get_time() + (uint64_t)(MICROPY_HW_USB_CDC_TX_TIMEOUT * 1000);
+ uint64_t timeout = esp_timer_get_time() + (uint64_t)(MICROPY_HW_USB_CDC_TX_TIMEOUT_MS * 1000);
while (tud_cdc_n_connected(CDC_ITF) && len && esp_timer_get_time() < timeout) {
size_t l = tinyusb_cdcacm_write_queue(CDC_ITF, (uint8_t *)str, len);
str += l;
@@ -88,4 +91,4 @@ void usb_tx_strn(const char *str, size_t len) {
}
}
-#endif // CONFIG_USB_ENABLED
+#endif // CONFIG_USB_OTG_SUPPORTED