Skip to content

Commit 108e7f0

Browse files
committed
ports/samd: Add support for USB devices defined in Python.
Currently disabled by default, set MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE to enable. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 543b0df commit 108e7f0

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
@@ -62,6 +62,11 @@
6262
// SAMD unique ID is 16 bytes (hex string == 32)
6363
#ifndef MICROPY_HW_USB_DESC_STR_MAX
6464
#define MICROPY_HW_USB_DESC_STR_MAX (32)
65+
66+
#ifndef MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE
67+
// Enable to use the 'usbd' module
68+
#define MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE (0)
69+
#endif
6570
#endif
6671
#endif
6772

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