"Anything that works" :-).
ie both your suggestions are OK and there are various others.
Convenience, cost, board area etc may have more affect once functionality is achieved.
A common method that is simple to implement at low frequencies and usable with extra design at higher frequencies is a voltage clamp.
In its simplest form Vin is fed to the uC via a resistor and a zener or clamp
regulator is connected fron uC pin to ground. The clamp voltage must be high enough worst-case to always exceed uC logic 1, and low enough that Vin max will not produce excess voltage at the uC pin.
The "easy way" is to use a TL431 / LM431 / ... clamp regulator. Also can be seen as a variable zener diode. These have defined accuracies, sharp turn in knees, programmable clamp voltage, lowish cost, wide availability, ... .
What's noyt to like ? :-)
For slightly lower cost and slightly more compact layout a zener diode and resistor can be used. The "simpler" solution will suffice but needs more design care.
it MAY be that the hall device uses an open collector/drain circuit with active pull down. If so, a clamp regulator or zener directly from output to ground may suffice, with direct connection to uC pin. Otherwise a resistor Rin from Hall to uC and a clamp or zener to ground at the uC is required.
A zener diode has a "soft knee" turn on voltage. As Izener increases Vzener_regulating rises. This is well covered in data sheets and application notes. With a 3V3 uC supply a 2V7 zener will probably suffice.
Call V at uC pin Vo or Vout
Rin should be dimensioned so as to
- Not draw excess current with Vin = 12V
- Not exceed Vo = 3V3 with Vin = 12V
- Provide enough voltage at Vo when Vin = 5V
- Not overload the Hall sensor output.
From $US0.35 each in 1's from Digikey, 9 cents in thousands.
2 or 3 cents in China in 1000's :-).
TL431 family datasheet