How to design a circuit that the input signal type(positive or negative) can be selected via software configuration
From the schematic it appears that you want to monitor the status of a signal that switches between +9 to +32 V and GND (0 V).

Switching pull-up to pull-down is an unusual approach and not necessary.


With R2 = 40 k&Omega;  you will easily detect a 'high' on the input.
With SW1 grounded R2, R4 and R1 form a potential divider on the input. The input voltage will be given by \$ V_i = \frac {1.01}{40 + 1.01}3.3 = 81 \ \text {mV} \$. This should be well below your logic low minimum allowable voltage.


You don't need to use pull-down.