Allow changing the USB VID, PID, manufacturer, and product via CMake (#1130)

This commit is contained in:
Stargirl Flowers 2022-12-03 00:39:01 -05:00 committed by GitHub
parent 616e120558
commit 56594e75af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,8 +32,21 @@
#include "pico/stdio_usb/reset_interface.h"
#include "pico/unique_id.h"
#ifndef USBD_VID
#define USBD_VID (0x2E8A) // Raspberry Pi
#endif
#ifndef USBD_PID
#define USBD_PID (0x000a) // Raspberry Pi Pico SDK CDC
#endif
#ifndef USBD_MANUFACTURER
#define USBD_MANUFACTURER "Raspberry Pi"
#endif
#ifndef USBD_PRODUCT
#define USBD_PRODUCT "Pico"
#endif
#define TUD_RPI_RESET_DESC_LEN 9
#if !PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
@ -102,8 +115,8 @@ static const uint8_t usbd_desc_cfg[USBD_DESC_LEN] = {
static char usbd_serial_str[PICO_UNIQUE_BOARD_ID_SIZE_BYTES * 2 + 1];
static const char *const usbd_desc_str[] = {
[USBD_STR_MANUF] = "Raspberry Pi",
[USBD_STR_PRODUCT] = "Pico",
[USBD_STR_MANUF] = USBD_MANUFACTURER,
[USBD_STR_PRODUCT] = USBD_PRODUCT,
[USBD_STR_SERIAL] = usbd_serial_str,
[USBD_STR_CDC] = "Board CDC",
#if PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE