Skip to content

Commit 7f5d8c4

Browse files
projectgusdpgeorge
authored andcommitted
samd: Enable support for Python USB devices.
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
1 parent 0baa3b5 commit 7f5d8c4

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

ports/samd/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ SHARED_SRC_C += \
136136
shared/tinyusb/mp_cdc_common.c \
137137
shared/tinyusb/mp_usbd.c \
138138
shared/tinyusb/mp_usbd_descriptor.c \
139+
shared/tinyusb/mp_usbd_runtime.c \
139140

140141
ASF4_SRC_C += $(addprefix lib/asf4/$(MCU_SERIES_LOWER)/,\
141142
hal/src/hal_atomic.c \

ports/samd/main.c

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ void samd_main(void) {
9393
pwm_deinit_all();
9494
#endif
9595
soft_timer_deinit();
96+
#if MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE
97+
mp_usbd_deinit();
98+
#endif
9699
gc_sweep_all();
97100
#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_UART
98101
sercom_deinit_all();

ports/samd/mpconfigport.h

+5
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,13 @@
6363
#ifndef MICROPY_HW_USB_DESC_STR_MAX
6464
#define MICROPY_HW_USB_DESC_STR_MAX (32)
6565
#endif
66+
// Support machine.USBDevice
67+
#ifndef MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE
68+
#define MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE (1)
6669
#endif
6770

71+
#endif // MICROPY_HW_ENABLE_USBDEV
72+
6873
#define MICROPY_PY_SYS_PLATFORM "samd"
6974

7075
// Extended modules

0 commit comments

Comments
 (0)