Added support for dynamic USB_VID / USB_PID.

It can be changed on runtime without rebuilding or patching.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2024-04-16 00:04:23 +02:00
parent b6b53010cc
commit 6f7ab69a9d
3 changed files with 13 additions and 3 deletions

View File

@@ -25,6 +25,7 @@
#endif
#include "pico_keys_version.h"
#include "usb.h"
#include "pico_keys.h"
#ifndef USB_VID
#define USB_VID 0xFEFF
@@ -39,11 +40,14 @@
#define MAX_USB_POWER 1
uint16_t usb_vid = USB_VID;
uint16_t usb_pid = USB_PID;
//--------------------------------------------------------------------+
// Device Descriptors
//--------------------------------------------------------------------+
tusb_desc_device_t const desc_device = {
tusb_desc_device_t desc_device = {
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = (USB_BCD),