mirror of
https://github.com/micropython/micropython.git
synced 2025-07-21 21:11:12 +02:00
esp32: Enable machine.USBDevice to configure USB at runtime.
This adds support for `machine.USBDevice` to S2 and S3 boards. Signed-off-by: Sebastian Romero <s.romero@arduino.cc>
This commit is contained in:
committed by
Damien George
parent
bdda91fe74
commit
5f2d05d417
@@ -78,6 +78,7 @@ if(MICROPY_PY_TINYUSB)
|
||||
${MICROPY_DIR}/shared/tinyusb/mp_usbd.c
|
||||
${MICROPY_DIR}/shared/tinyusb/mp_usbd_cdc.c
|
||||
${MICROPY_DIR}/shared/tinyusb/mp_usbd_descriptor.c
|
||||
${MICROPY_DIR}/shared/tinyusb/mp_usbd_runtime.c
|
||||
)
|
||||
|
||||
list(APPEND MICROPY_INC_TINYUSB
|
||||
|
@@ -183,6 +183,10 @@ soft_reset_exit:
|
||||
mp_thread_deinit();
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE
|
||||
mp_usbd_deinit();
|
||||
#endif
|
||||
|
||||
gc_sweep_all();
|
||||
|
||||
// Free any native code pointers that point to iRAM.
|
||||
|
@@ -215,6 +215,10 @@
|
||||
#else
|
||||
#define MICROPY_HW_USB_VID (CONFIG_TINYUSB_DESC_CUSTOM_VID)
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE
|
||||
#define MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE (1) // Support machine.USBDevice
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_HW_USB_PID
|
||||
|
Reference in New Issue
Block a user