summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2024-03-13 12:17:20 +1100
committerDamien George <damien@micropython.org>2024-03-15 13:37:42 +1100
commit43904acea8b2087fdf9f283c0f8ce7d92d16e605 (patch)
tree941dcac783cb45ea1a73152394c5f057e1329556
parent47e84751fb55fb522557ca3f2349c8a25295498a (diff)
mimxrt: Define the MICROPY_HW_ENABLE_USBDEV macro.
Previously USB was always enabled, but this created some conflicts when adding guards to other files on other ports. Note the configuration with USB disabled hasn't been tested and probably won't build or run without further work. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-rw-r--r--ports/mimxrt/main.c2
-rw-r--r--ports/mimxrt/mpconfigport.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/ports/mimxrt/main.c b/ports/mimxrt/main.c
index 761c49174..dddf44e60 100644
--- a/ports/mimxrt/main.c
+++ b/ports/mimxrt/main.c
@@ -115,7 +115,9 @@ int main(void) {
// Execute user scripts.
int ret = pyexec_file_if_exists("boot.py");
+ #if MICROPY_HW_ENABLE_USBDEV
mp_usbd_init();
+ #endif
if (ret & PYEXEC_FORCED_EXIT) {
goto soft_reset_exit;
diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h
index 637c38f43..a4c6d6e20 100644
--- a/ports/mimxrt/mpconfigport.h
+++ b/ports/mimxrt/mpconfigport.h
@@ -147,6 +147,8 @@ uint32_t trng_random_u32(void);
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-mimxrt"
#endif
+#define MICROPY_HW_ENABLE_USBDEV (1)
+
// Hooks to add builtins
#if defined(IOMUX_TABLE_ENET)