diff options
| author | robert-hh <robert@hammelrath.com> | 2023-03-18 09:08:08 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-03-20 22:33:45 +1100 |
| commit | be686e634eede19f33612122d7254007a3d72bd0 (patch) | |
| tree | e2b28b24682afc101345b30090d40538c04482c4 /shared/tinyusb | |
| parent | a2b31f968d8df46fc2e7acd224011415e6ed43a2 (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')
| -rw-r--r-- | shared/tinyusb/mp_cdc_common.c | 2 | ||||
| -rw-r--r-- | shared/tinyusb/mp_usbd.c | 6 | ||||
| -rw-r--r-- | shared/tinyusb/mp_usbd_descriptor.c | 7 |
3 files changed, 13 insertions, 2 deletions
diff --git a/shared/tinyusb/mp_cdc_common.c b/shared/tinyusb/mp_cdc_common.c index 00b72e74b..cd4f5d101 100644 --- a/shared/tinyusb/mp_cdc_common.c +++ b/shared/tinyusb/mp_cdc_common.c @@ -28,7 +28,7 @@ #include "py/mphal.h" #include "modmachine.h" -#if MICROPY_HW_USB_CDC_1200BPS_TOUCH +#if MICROPY_HW_USB_CDC_1200BPS_TOUCH && MICROPY_HW_ENABLE_USBDEV #include "tusb.h" 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 diff --git a/shared/tinyusb/mp_usbd_descriptor.c b/shared/tinyusb/mp_usbd_descriptor.c index 3a21baf5b..c6d205c92 100644 --- a/shared/tinyusb/mp_usbd_descriptor.c +++ b/shared/tinyusb/mp_usbd_descriptor.c @@ -25,7 +25,10 @@ * THE SOFTWARE. */ -#include "mpconfigport.h" +#include "py/mpconfig.h" + +#if MICROPY_HW_ENABLE_USBDEV + #include "tusb.h" #include "mp_usbd.h" #include "mp_usbd_internal.h" @@ -126,3 +129,5 @@ const uint8_t *tud_descriptor_configuration_cb(uint8_t index) { (void)index; return mp_usbd_desc_cfg_static; } + +#endif |
