Run Different Functions Based on GPIO Mode (PA12 as Input or Output) – STM32G0
Hi everyone,
I'm working on an STM32G070CBTx, and I need to execute two different functions depending on the GPIO mode of pin PA12.
Specifically:
If PA12 is configured as input (GPIO_MODE_INPUT), I want to run function1()
If PA12 is configured as output push-pull (GPIO_MODE_OUTPUT_PP), I want to run function2()
Is there a way in HAL or LL to check the current mode of PA12 at runtime?
Or do I need to track the mode manually when I configure it?
Any suggestions or best practices for this kind of conditional GPIO-mode-based logic would be appreciated!
Thanks in advance!

