I am new to stm32f427 board and I am digging a bit deeper. I think that on the internet, especially StackOverflow, people sort of agreed on this, just an example:
void EXTI9_5_IRQHandler(void) {
/* Make sure that interrupt flag is set */
if (EXTI_GetITStatus(EXTI_Line5) != RESET) {
/* Do your stuff when PB5 is changed */
/* Clear interrupt flag */
EXTI_ClearITPendingBit(EXTI_Line5);
}
}
This handler, as everyone explained, needs to do whatever you need inside and must clear the pending flag when exiting the interrupt, and people claim that the pending bit is the interrupt flag.
However, in my case and many cases like here, they clear this bit first but many people claim that doing this will kill your interrupt functionality since you will be clearing the bit as soon as you get it. However, this is not the case, and moreover, it's totally the opposite. If I don't do it clearly first, my code would never work.
I want to figure out the reason behind it. Could someone kindly explain?