2 Replies Latest reply on Apr 20, 2019 11:31 AM by BiBi_1928986

    ClearInterrupt vs ClearPending vs do nothing when 'logic' drives Interrupt component


      xxx_ClearInterrupt() works for clearing a GPIO interrupt when connected to the Interrupt component.  This is well documented in several example projects and technical articles.  No problem there.


      When logic is connected to Interrupt component, I expected xxx_ClearPending() would be used, as documented in Interrupt component datasheet.  However, after building a simple project to test this, I found xxx_ClearPending() wasn't needed at all.  It didn't hurt anything when the code was in place, but commenting it out made no difference.  The project worked without issue.


      I've attached my example project archive along with 'main' and a screen shot of schematic.  It's just 2 switches, 2 LEDs (one is not actually used in this example code), KIT-049-42xx.  Input GPIO's have resistive pullup.  The switches are normally closed to ground (not to be confused with schematic drawing of switch).  When SW1 is pressed, LED0 is ON for 5 seconds.  When SW0 is pressed, LED0 is OFF for 5 seconds.  During either of the 5 second intervals, the 'other' switch can be pressed and released.  This was used to confirm the ISR's were working correctly, both with and without xxx_ClearPending().


      Can anybody explain why xxx_ClearPending() is not needed to clear the interrupt?