tri state buffer?

Yeah that's part of the challenge lol, getting it to do the whole thing itself is there a op ampt setup where it outputs high when the absolute difference is more than a set amount?

Yes, you could make an op amp circuit with hysteris that will have a band where the output will not change, and anything below that will be low and anything above that would be high.

I have been thinking about this project and I am sure it COULD be done. But the question is what do you give up? Most likely if you do get it to work you will give up reliability or flexibility or cost.

The MCU has several internal registers per IO pin for settings like pull up, High, Low, reading input. All that comes out 1 pin. What you are dealing with are really 4 internal states. One problem you have with trying to float the pin at some 1/2 way point is that as an input that is undefined and can lead to unpredictable readings. Also you can't determine where the load on a pin is coming from, it could be an internal pull up or digital high, could also be an external pull up or component feeding a signal. If you do find some way to create a voltage drop or current flow you will probably end up making the circuit VERY sensitive to external voltages. Minimum digital high becomes 4.3 V instead of closer to 3 V. Another possibility is you use a second MCU with an analog pin or 2 reading the voltage level at the IO pin via a couple of voltage dividers. and a few output pins to a high current tri-state out and a couple of transistors to pull the original IO pin to some predefined voltage. If your lucky you could get away with an 8 pin mcu and a dozen other resistors and transistors.

All in all it seams like a convoluted solution to some thing that really is not a problem. Just put a mosfet and 2 resisters with a jumper select for direct or boosted and call it good. Simple, elegant, and robust.

The L293 does that already, and having a pin to drive the enable line provides flexibility. With just the MOSFETs, one driver or the other will be on all the time.

The L293 does that already, and having a pin to drive the enable line provides flexibility. With just the MOSFETs, one driver or the other will be on all the time.

I was referring to making the whole thing automatic with out adding any changes to code. I agree the L293 is also a good solution. It's a compromise one way or the other. Personally if I need more output I add the components appropriate to the load. I just don't see a way to make the whole thing automatic with out compromising on adding an enable pin.

Lol yeah I never said it would be a practical idea
that’s true about someone having external pullups, that would just about kill it, but technically if I keep it at 2.5v will that gives me a steady low? Its below 3.3v and if its like 500 ohm resistors it’d be very robust to interference
another problem would be If you need pullup resistors that would cause it to be weird
but then again I could select a dummy current of like 10ma triggering the output, the very small current from a pullup would not affect it too bad, especially if I figure out that hysterisis trigger I can make a wider gap of play
a drawback would be that even if all the pins are set to input there’s 5ma on each voltage divider so say 20pins x 5ma is 100 ma just to sense, which its not like low power consumption is a goal so I guess it doesn’t matter