Skip to content

Commit d7f396c

Browse files
committed
ports/samd: Add support for USB devices defined in Python.
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au> Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 7b605e1 commit d7f396c

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

ports/samd/Makefile

Lines changed: 1 addition & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy