This is not overriding the right pin macros at all. There are zero results when looking for a code reference to it.
Since you are using board = genericSTM32F411CE
we have the used Arduino variant as
and that variant_generic.h file has
Which is in turn used to create
which is in turn what the Wire (I2C) library uses to construct its Wire
object on by default
So your platformio.ini
should be
[env:genericSTM32F411CE]
platform = ststm32
board = genericSTM32F411CE
framework = arduino
upload_protocol = dfu
build_flags =
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D USBCON
-D HSE_VALUE=8000000
-D PIN_WIRE_SDA=PB7
-D PIN_WIRE_SCL=PB6
Equally, you can construct a different or more Wire
object or redefine pins on the fly, as is documented in