Use bluepad32 Library in PIO

The key to this is to understand that the Bluepad32 “library” for the Arduino IDE and ESP32 is actually included in the alternative version of the Arduino-ESP32 core that the author provides. See documentation.

The board URL that they make you install in the Arduino IDE (https://raw.githubusercontent.com/ricardoquesada/esp32-arduino-lib-builder/master/bluepad32_files/package_esp32_bluepad32_index.json) then points to the package https://github.com/ricardoquesada/esp32-arduino-lib-builder/releases/download/4.1.0/esp32-bluepad32-4.1.0.zip which is just a packaging of Arduino-ESP32 with the Bluepad32 library included.

You need to tell PlatformIO to use that as the Arduino-ESP32 framework package instead of the regular framework-arduinoespressif32 package. The .zip file I linked to already has a package.json for inclusion into PlatformIO. Sadly however, the name field of the package was changed to framework-arduinoespressif32bluepad32, so it will be rejected as a replacement for framework-arduinoespressif32 until renamed. (Otherwise,we could have referenced the release zip directly.)

Thus, I simply renamed it back to framework-arduinoespressif32 and reuploaded it here. With that, I can then tell PlatformIO to simply use this as the Arduino core package.

[env:esp32dev]
platform = espressif32@6.10.0
board = esp32dev
framework = arduino
; reupload of https://github.com/ricardoquesada/esp32-arduino-lib-builder/releases/download/4.1.0/esp32-bluepad32-4.1.0.zip
; but with package.json's "name" field renamed back to framework-arduinoespressif32
platform_packages =
   framework-arduinoespressif32@https://github.com/maxgerhardt/pio-framework-bluepad32/archive/refs/heads/main.zip

You can see that the Controller.ino example compiles perfectly fine with this configuration then:

2 Likes