3 Replies Latest reply on May 20, 2018 3:15 AM by AlanH_86

    GPIO Interrupt Callback?

      Hi

       

      I can't seem to find clear documentation regarding setup of GPIO interrupts and setting the callbacks.  For example, I see the edge type is set up in the GUI on the schematic, but then in the example program CE220263 there is redundant code to do the same thing.

       

      Thanks in advance,

      Scott

        • 1. Re: GPIO Interrupt Callback?
          AlanH_86

          Well... I think the CE220263 is a perfect example of us getting out of control making a huge code example for a simple idea.

           

          The code example was setup to show both a "pure pdf" and an old style creator implementation of a pin interrupt.

           

          But to your answer.

           

          The last line in the ISR (and the file) clears the interrupt source in the port interrupt.

           

          Cy_GPIO_ClearInterrupt(SW2_P0_4_PORT, SW2_P0_4_NUM);

          • 2. Re: GPIO Interrupt Callback?

            Thanks for your prompt answer..

             

            So besides calling the function you mentioned in the ISR callback to clear the interrupt, do I also need to make a call to

             

            NVIC_ClearPendingIRQ

             

            or is this handled in the call to Gy_GPIO_ClearInterrupt?

             

            Thanks again,

            Scott

            • 3. Re: GPIO Interrupt Callback?
              AlanH_86

              The specific answer to your question is.  No.  You dont need to clear the interrupt.

               

              But it was not "Or is this handled..." because ARM Interrupts are cleared when you service them.

               

              Obviously they immediately re-pend if you dont clear the source...

               

              Alan