Skip to content

Commit 100e19c

Browse files
committed
stm32/usb: Use TinyUSB stack by default on PREVIEW_VERSION_2.
Signed-off-by: Andrew Leech <andrew@alelec.net>
1 parent 52a6912 commit 100e19c

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

ports/stm32/modmachine.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "rtc.h"
4848
#include "i2c.h"
4949
#include "spi.h"
50+
#include "shared/tinyusb/mp_usbd.h"
5051

5152
#if defined(STM32G0)
5253
// G0 has BOR and POR combined

ports/stm32/mpconfigboard_common.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@
114114
#define MICROPY_HW_TINYUSB_STACK (0)
115115
#endif
116116

117+
#define MICROPY_HW_ENABLE_USBDEV 1
118+
#define MICROPY_HW_USB_CDC 1
119+
#define MICROPY_HW_USB_FS (1)
120+
121+
#ifndef MICROPY_HW_TINYUSB_STACK
122+
#define MICROPY_HW_TINYUSB_STACK (MICROPY_PREVIEW_VERSION_2)
123+
#endif
124+
125+
// Support machine.USBDevice (only available with TinyUSB)
126+
#ifndef MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE
127+
#define MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE (MICROPY_HW_TINYUSB_STACK)
128+
#endif
129+
117130
// Whether to enable the PA0-PA3 servo driver, exposed as pyb.Servo
118131
#ifndef MICROPY_HW_ENABLE_SERVO
119132
#define MICROPY_HW_ENABLE_SERVO (0)

ports/stm32/mphalport.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,7 @@ enum {
148148
void mp_hal_generate_laa_mac(int idx, uint8_t buf[6]);
149149
void mp_hal_get_mac(int idx, uint8_t buf[6]);
150150
void mp_hal_get_mac_ascii(int idx, size_t chr_off, size_t chr_len, char *dest);
151+
152+
static inline void mp_hal_wake_main_task_from_isr(void) {
153+
// Defined for tinyusb support, nothing needs to be done here.
154+
}

0 commit comments

Comments
 (0)