Change the status of a variable when a button is pressed via interrupt routine.
I am implementing an application when I need to set high a status variable when a button is pressed. I would like to do so via the interrupt routine of the push button. So, in gpio.c I have
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){
if (GPIO_Pin == GPIO_PIN_0){
PB1_isPressed = 1;
}
}In the main.c I would like to have a statement like:
if (PB1_isPressed ==1){
do something
}
Now my questions are the following:
- Is this a good practice?
- where do I declare PB1_isPressed? and how?
Sorry for the very basic questions and thank you all for the help in advance :)



