Entering and exiting stand-by mode on interrupt
I'm a beginner in embedded systems. I'm creating a software where some leds are blinking in the main while loop. I would like to put the MCU into stand-by mode when connecting a certain pin. I want to return to normal execution when this pin is disconnected. Right now I'm using a SYS_WKUP pin to exit the stand-by mode. Could I somehow use the same pin to enter stand-by mode. What is the best way to implement this?
Right now i can enter stand-by mode in the middle of the main loop and exit stand-by mode when connecting the pin, but I don't know how to enter the stand-by mode as i connect the pin.
I have the NUCLEO G031K8 and I'm programming with STM32CubeIDE.
