diff options
| author | Angus Gratton <angus@redyak.com.au> | 2023-11-23 09:53:16 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-03-15 14:24:52 +1100 |
| commit | 7f5d8c4605e9305b7d1dbb100d6704618f8f3b4b (patch) | |
| tree | 2592ff197d243d5c40f611a1a68adacebd7d359d | |
| parent | 0baa3b5528257d2d8c3ada5842885d83b9acbb75 (diff) | |
samd: Enable support for Python USB devices.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
| -rw-r--r-- | ports/samd/Makefile | 1 | ||||
| -rw-r--r-- | ports/samd/main.c | 3 | ||||
| -rw-r--r-- | ports/samd/mpconfigport.h | 5 |
3 files changed, 9 insertions, 0 deletions
diff --git a/ports/samd/Makefile b/ports/samd/Makefile index 5a7cb9916..b678cd982 100644 --- a/ports/samd/Makefile +++ b/ports/samd/Makefile @@ -136,6 +136,7 @@ SHARED_SRC_C += \ shared/tinyusb/mp_cdc_common.c \ shared/tinyusb/mp_usbd.c \ shared/tinyusb/mp_usbd_descriptor.c \ + shared/tinyusb/mp_usbd_runtime.c \ ASF4_SRC_C += $(addprefix lib/asf4/$(MCU_SERIES_LOWER)/,\ hal/src/hal_atomic.c \ diff --git a/ports/samd/main.c b/ports/samd/main.c index f051e961f..9f213f27d 100644 --- a/ports/samd/main.c +++ b/ports/samd/main.c @@ -93,6 +93,9 @@ void samd_main(void) { pwm_deinit_all(); #endif soft_timer_deinit(); + #if MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE + mp_usbd_deinit(); + #endif gc_sweep_all(); #if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_UART sercom_deinit_all(); diff --git a/ports/samd/mpconfigport.h b/ports/samd/mpconfigport.h index 28a99333d..0b47500bf 100644 --- a/ports/samd/mpconfigport.h +++ b/ports/samd/mpconfigport.h @@ -63,8 +63,13 @@ #ifndef MICROPY_HW_USB_DESC_STR_MAX #define MICROPY_HW_USB_DESC_STR_MAX (32) #endif +// Support machine.USBDevice +#ifndef MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE +#define MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE (1) #endif +#endif // MICROPY_HW_ENABLE_USBDEV + #define MICROPY_PY_SYS_PLATFORM "samd" // Extended modules |
