esp8266: open drain PWM?
When driving a high-side switching transistor with an external pull-up resistor the Pin.OPEN_DRAIN output works well (with negative logic, so grounding the output turns it on and letting it float turns it off). The PWM module however has a comment that it explicitly disables the open drain, which prevents the transistor from being able to fully turn off: https://github.com/micropython/micropython/blob/master/ports/esp8266/esppwm.c#L387
Is there a reason to do this rather than leaving the pin in the mode configured by the python code?
esp8266: enable real open drain output on the pins
As noted in #5696, there were issues with PWM for Pin.OPEN_DRAIN gpio output mode. However, open drain was not being enabled, it was only emulated with the Pin.value() function. This adds calls mp_hal_pin_open_drain() to put the pin into true open drain mode and removes the emulation code from Pin.value().
It also removes the code that was explicitly turning off the open drain output during PWM. Together these changes allow driving external transistor high-current switches.