You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following pseudocode:
attachInterrupt()....enable interrupts on a pin on falling edge
...
ISR: deal with an interrupt and clear INTFLAG
...
detachInterrupt()...disable interrupt on the pin
...
there is a falling edge on the pin while interrupts are disabled
...
attachInterrupt()...enable interrupts again
An interrupt will be generated, even if the interrupt flag was cleared in the ISR!
This doesn't happen if the interrupt flag is cleared immediately before attachInterrupt() is called:
e.g. for EXTINT[6] REG_EIC_INTFLAG = EIC_INTFLAG_EXTINT6; // Clear the EXTINT6 flag
It seems to make sense to modify attachInterrupt() to clear the interrupt flag before enabling the interrupt, and/or add a function to clear the interrupt that doesn't require the user to go into the spec sheet and Google and figure everything out by themselves.
The text was updated successfully, but these errors were encountered:
This is somewhat intentional, to allow temporarily disabling such an interrupt without losing events (at least that's how the current behaviour is being used by some).
Consider the following pseudocode:
attachInterrupt()....enable interrupts on a pin on falling edge
...
ISR: deal with an interrupt and clear INTFLAG
...
detachInterrupt()...disable interrupt on the pin
...
there is a falling edge on the pin while interrupts are disabled
...
attachInterrupt()...enable interrupts again
An interrupt will be generated, even if the interrupt flag was cleared in the ISR!
This doesn't happen if the interrupt flag is cleared immediately before attachInterrupt() is called:
e.g. for EXTINT[6]
REG_EIC_INTFLAG = EIC_INTFLAG_EXTINT6; // Clear the EXTINT6 flag
It seems to make sense to modify attachInterrupt() to clear the interrupt flag before enabling the interrupt, and/or add a function to clear the interrupt that doesn't require the user to go into the spec sheet and Google and figure everything out by themselves.
The text was updated successfully, but these errors were encountered: