Allow changing the USB VID, PID, manufacturer, and product via CMake (#1130)
This commit is contained in:
parent
616e120558
commit
56594e75af
@ -32,8 +32,21 @@
|
|||||||
#include "pico/stdio_usb/reset_interface.h"
|
#include "pico/stdio_usb/reset_interface.h"
|
||||||
#include "pico/unique_id.h"
|
#include "pico/unique_id.h"
|
||||||
|
|
||||||
|
#ifndef USBD_VID
|
||||||
#define USBD_VID (0x2E8A) // Raspberry Pi
|
#define USBD_VID (0x2E8A) // Raspberry Pi
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USBD_PID
|
||||||
#define USBD_PID (0x000a) // Raspberry Pi Pico SDK CDC
|
#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
|
#define TUD_RPI_RESET_DESC_LEN 9
|
||||||
#if !PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
|
#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 char usbd_serial_str[PICO_UNIQUE_BOARD_ID_SIZE_BYTES * 2 + 1];
|
||||||
|
|
||||||
static const char *const usbd_desc_str[] = {
|
static const char *const usbd_desc_str[] = {
|
||||||
[USBD_STR_MANUF] = "Raspberry Pi",
|
[USBD_STR_MANUF] = USBD_MANUFACTURER,
|
||||||
[USBD_STR_PRODUCT] = "Pico",
|
[USBD_STR_PRODUCT] = USBD_PRODUCT,
|
||||||
[USBD_STR_SERIAL] = usbd_serial_str,
|
[USBD_STR_SERIAL] = usbd_serial_str,
|
||||||
[USBD_STR_CDC] = "Board CDC",
|
[USBD_STR_CDC] = "Board CDC",
|
||||||
#if PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
|
#if PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
|
||||||
|
Loading…
Reference in New Issue
Block a user