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>
This commit is contained in:
Angus Gratton
2024-01-18 08:52:16 +11:00
committed by Damien George
parent 5d83bbca60
commit 00ba6aaae4
8 changed files with 38 additions and 21 deletions

View File

@@ -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);