summaryrefslogtreecommitdiff
path: root/shared/tinyusb/mp_usbd.h
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-11-27 15:00:12 +1100
committerDamien George <damien@micropython.org>2025-11-29 23:23:46 +1100
commit14b5080515ec483f0f7be843a089eea835e4519f (patch)
treebfb84d1212290f6878934ea370d4c1fd0318f6f9 /shared/tinyusb/mp_usbd.h
parent9b73e344ebdb9f086013ff45e9dc73af33d2c0d1 (diff)
shared/tinyusb: Add optional port-specific hook on USBD init.
This allows a port to do hardware initialization just before the TinyUSB stack is brought up. That means the hardware is only turned on when it's needed. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'shared/tinyusb/mp_usbd.h')
-rw-r--r--shared/tinyusb/mp_usbd.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/shared/tinyusb/mp_usbd.h b/shared/tinyusb/mp_usbd.h
index 311575b3a..d73cb5ade 100644
--- a/shared/tinyusb/mp_usbd.h
+++ b/shared/tinyusb/mp_usbd.h
@@ -45,6 +45,10 @@
#define MICROPY_WRAP_TUD_EVENT_HOOK_CB(name) name
#endif
+#ifndef MICROPY_HW_TINYUSB_LL_INIT
+#define MICROPY_HW_TINYUSB_LL_INIT()
+#endif
+
#if MICROPY_HW_ENABLE_USBDEV
#include "py/obj.h"
@@ -102,6 +106,7 @@ void mp_usbd_task_callback(mp_sched_node_t *node);
static inline void mp_usbd_init(void) {
// Without runtime USB support, this can be a thin wrapper wrapper around tusb_init()
// which is called in the below helper function.
+ MICROPY_HW_TINYUSB_LL_INIT();
mp_usbd_init_tud();
}