unwind
a day ago
Neat! It's great when old hardware can be made better and given new features (and extending the life-span) by semi-simple means like this. It's also amazing to see how often a 3D printer pops up in these projects, nowadays.
This paragraph stood out a little to me:
We only need two pins (which the STM32 is total overkill for): GND and a GPIO. The only thing really making this harder than just turning it on/off is that we need to both read the voltage and write it but this protocol is so slow you can literally just change the type on the fly lol—or as we are doing, just making it both an in- and output.
There's like two levels of semi out of the box thinking here: one is the solution the OP came up with, the fact that even if a pin is in output mode, the input circuitry often still just works so you can read the pin. The other is of course to connect the signal to one more external pin (the OP even made a point of there being a huge abundance of pins) and program that as a permanent input (electrically I believe this is safe, inputs are high-impendance, but a series resistor wouldn't hurt for semi-low speed signals as far as I know).