How to accept switched GND or switched Positive on a 3v3 MCU input
How about:


This assumes a 5V microcontroller, common ground between 5V and 30V circuits and suitably chosen mosfets.

Note that M1 (P-Channel mosfet) is installed with the source facing the 5V rail.

When your microcontroller outputs a logic high, the N-Channel turns on and the P-Channel turns off (simultaneously) which enable the pull-down R3.  A logic low will do the opposite and turn on the pull-up R2.  D1 and R1 are the protection circuitry to drop the 30V level down to something the micro will be happy with.

Additional info: This circuit can be modified slightly to put the pull-up/down on the high-voltage side if you want that instead, just move D1 &amp; R1 to be on the microcontroller side and use mosfets suitable for 30V switching.