Update PIO USB docs, fixup used VID/PID macros (#2505)

This commit is contained in:
Maximilian Gerhardt 2024-09-30 18:57:21 +02:00 committed by GitHub
parent 25501953df
commit a2164a5b10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 2 deletions

View file

@ -262,6 +262,18 @@ default Pico SDK USB stack. To change it, add
Note that the special "No USB" setting is also supported, through the
shortcut-define ``PIO_FRAMEWORK_ARDUINO_NO_USB``.
USB Customization
-----------------
If you want to change the USB VID, PID, product or manufacturer name that the device will appear under, configure them as follows:
.. code:: ini
board_build.arduino.earlephilhower.usb_manufacturer = Custom Manufacturer
board_build.arduino.earlephilhower.usb_product = Ultra Cool Product
board_build.arduino.earlephilhower.usb_vid = 0xABCD
board_build.arduino.earlephilhower.usb_pid = 0x1337
IP Stack
--------

View file

@ -337,11 +337,15 @@ def configure_usb_flags(cpp_defines):
env.Append(CPPDEFINES=[
("CFG_TUSB_MCU", "OPT_MCU_RP2040"),
# used by TinyUSB stack
("USB_VID", usb_vid),
("USB_PID", usb_pid),
# Used by native USB stack
("USBD_VID", usb_vid),
("USBD_PID", usb_pid),
# Used by both stacks
("USB_MANUFACTURER", '\\"%s\\"' % usb_manufacturer),
("USB_PRODUCT", '\\"%s\\"' % usb_product),
("SERIALUSB_PID", usb_pid)
("USB_PRODUCT", '\\"%s\\"' % usb_product)
])
if "USBD_MAX_POWER_MA" not in env.Flatten(env.get("CPPDEFINES", [])):