This PR is not intended for merging, rather it is a proof of concept and a basis for discussion.
Scope
It lets you use one or more I2C I/O Expanders – in this case PCF8574 – to provide supplemental low-speed output via M62 and M63. USERDIGITALPIN numbers are extended so that GPIO numbers >= 64 refer to expander pins. The expanded access functions apply only to the M62 and M63 cases, so there is no speed impact on high-speed I/O.
Discussion
I tried to implement it by overriding the weak definitions of digitalWrite and pinMode, but making that work required a change in esp32halgpio.h to expose the otherwise-hidden functions digitalWrite() and pinMode() for the fallback code. Modifying system functions seemed like a bad idea so I introduced macros EXPANDERDIGITALWRITE and EXPANDERPINMODE that resolve to digitalWrite and pinMode in the default case, and to expanderDigitalWrite and expanderPinMode if I/O Expander support is present.
Except for the plumbing for those macros and a bit of #include wrangling that is necessary to make the build system do the right thing, the main changes are buried in a new file Custom/pick_place.cpp .