summaryrefslogtreecommitdiff
path: root/shared/tinyusb/mp_usbd.c
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2023-03-18 09:08:08 +0100
committerDamien George <damien@micropython.org>2023-03-20 22:33:45 +1100
commitbe686e634eede19f33612122d7254007a3d72bd0 (patch)
treee2b28b24682afc101345b30090d40538c04482c4 /shared/tinyusb/mp_usbd.c
parenta2b31f968d8df46fc2e7acd224011415e6ed43a2 (diff)
rp2: Allow disabling USB via MICROPY_HW_ENABLE_USBDEV config.
Previously, setting MICROPY_HW_ENABLE_USBDEV to 0 caused build errors. The change affects the nrf and samd ports as well, so MICROPY_HW_ENABLE_USBDEV had to be explicitly enabled there. The configuration options MICROPY_HW_ENABLE_USBDEV and MICROPY_HW_ENABLE_UART_REPL are independent, and can be enabled or disabled by a board. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'shared/tinyusb/mp_usbd.c')
-rw-r--r--shared/tinyusb/mp_usbd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/shared/tinyusb/mp_usbd.c b/shared/tinyusb/mp_usbd.c
index 91d35a2b4..0edc48988 100644
--- a/shared/tinyusb/mp_usbd.c
+++ b/shared/tinyusb/mp_usbd.c
@@ -26,6 +26,10 @@
#include <stdlib.h>
+#include "py/mpconfig.h"
+
+#if MICROPY_HW_ENABLE_USBDEV
+
#ifndef NO_QSTR
#include "tusb.h" // TinyUSB is not avaiable when running the string preprocessor
#include "device/usbd.h"
@@ -35,3 +39,5 @@
void usbd_task(void) {
tud_task_ext(0, false);
}
+
+#endif