From 7ae9e6ef6900ad2d386bf5453b47a89b026b51f1 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Tue, 27 Jul 2021 18:32:38 +0200 Subject: [PATCH] rp2/tusb_port: Allow boards to configure USB VID and PID. By defining MICROPY_HW_USB_VID and MICROPY_HW_USB_PID. --- ports/rp2/tusb_port.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ports/rp2/tusb_port.c b/ports/rp2/tusb_port.c index 874d837b9b..8896be9077 100644 --- a/ports/rp2/tusb_port.c +++ b/ports/rp2/tusb_port.c @@ -27,8 +27,12 @@ #include "tusb.h" #include "pico/unique_id.h" -#define USBD_VID (0x2E8A) // Raspberry Pi -#define USBD_PID (0x0005) // RP2 MicroPython +#ifndef MICROPY_HW_USB_VID +#define MICROPY_HW_USB_VID (0x2E8A) // Raspberry Pi +#endif +#ifndef MICROPY_HW_USB_PID +#define MICROPY_HW_USB_PID (0x0005) // RP2 MicroPython +#endif #define USBD_DESC_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN) #define USBD_MAX_POWER_MA (250) @@ -58,8 +62,8 @@ static const tusb_desc_device_t usbd_desc_device = { .bDeviceSubClass = MISC_SUBCLASS_COMMON, .bDeviceProtocol = MISC_PROTOCOL_IAD, .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE, - .idVendor = USBD_VID, - .idProduct = USBD_PID, + .idVendor = MICROPY_HW_USB_VID, + .idProduct = MICROPY_HW_USB_PID, .bcdDevice = 0x0100, .iManufacturer = USBD_STR_MANUF, .iProduct = USBD_STR_PRODUCT,