summaryrefslogtreecommitdiff
path: root/shared/tinyusb/mp_usbd.h
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2024-01-18 08:52:16 +1100
committerDamien George <damien@micropython.org>2024-02-15 12:31:26 +1100
commit00ba6aaae4c815fc9685defc37a5df1424180c0e (patch)
tree4743d1da4a9ee2f076f70405a6403ed755a5b14e /shared/tinyusb/mp_usbd.h
parent5d83bbca60ea3f4071b9245daf8a41296072f918 (diff)
ports: On cold boot, enable USB after boot.py completes.
For mimxrt, nrf, renesas-ra, rp2 and samd ports, this commit implements similar behaviour to the stm32 port, where USB is only brought up after boot.py completes execution. Currently this doesn't add any useful functionality (and may break workflows that depend on USB-CDC being live in boot.py), however it's a precondition for more usable workflows with USB devices defined in Python (allows setting up USB interfaces in boot.py before the device enumerates for the first time). This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'shared/tinyusb/mp_usbd.h')
-rw-r--r--shared/tinyusb/mp_usbd.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/shared/tinyusb/mp_usbd.h b/shared/tinyusb/mp_usbd.h
index 83a8f8617..89f8bf0ee 100644
--- a/shared/tinyusb/mp_usbd.h
+++ b/shared/tinyusb/mp_usbd.h
@@ -28,6 +28,13 @@
#define MICROPY_INCLUDED_SHARED_TINYUSB_MP_USBD_H
#include "py/obj.h"
+#include "tusb.h"
+
+static inline void mp_usbd_init(void) {
+ // Currently this is a thin wrapper around tusb_init(), however
+ // runtime USB support will require this to be extended.
+ tusb_init();
+}
// Call this to explicitly run the TinyUSB device task.
void mp_usbd_task(void);