Skip to content
Manuel Bl edited this page Apr 27, 2023 · 1 revision

The USB Power Delivery for Arduino library is available via PlatformIO is as well. It can be used with a single lib_deps entry in platformio.ini:

lib_deps =
    manuelbl/USBPowerDelivery

Below is a more elaborate platformio.ini file. It supports multiple boards (select yours in the status bar of Visual Studio Code), and it enables serial output through the USB data line for the Bluepill and Blackpill board.

[env]
platform = ststm32
framework = arduino
lib_deps =
    manuelbl/USBPowerDelivery

[env:nucleo_l432kc]
board = nucleo_l432kc

[env:bluepill_f103c8]
board = bluepill_f103c8
build_flags =
   -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
   -D USBCON
   -D HAL_PCD_MODULE_ENABLED
   -D USBD_VID=0xCAFE
   -D USBD_PID=0xDEAD
   -D USB_MANUFACTURER_STRING="\"Your Name\""
   -D USB_PRODUCT_STRING="\"Your Project\""

[env:blackpill_f401cc]
board = blackpill_f401cc
debug_tool = stlink
build_flags =
   -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
   -D USBCON
   -D HAL_PCD_MODULE_ENABLED
   -D USBD_VID=0xCAFE
   -D USBD_PID=0xDEAD
   -D USB_MANUFACTURER_STRING="\"Your Name\""
   -D USB_PRODUCT_STRING="\"Your Project\""

[env:nucleo_g431kb]
board = nucleo_g431kb
Clone this wiki locally