Hello,
it seems it is not your fault, but your board not have supported (or implemented) OpenDrain PinMode.
For compare with another board:
- Your board - mbed-os/PinNames.h at 8a0c3c79157342f5d27ff259c12f04c7dd2ab4ad · ARMmbed/mbed-os · GitHub
- STM boads - mbed-os/PinNamesTypes.h at a3be10c976c36da222517abc0cb4f81e88ff8552 · ARMmbed/mbed-os · GitHub
Try to use the second library.
BR, Jan