GPIO Interrupt Callback?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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

0 Likes
1 Solution
AlanH_86
Employee
Employee
100 replies posted 50 replies posted 25 solutions authored

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);

View solution in original post

0 Likes
3 Replies
AlanH_86
Employee
Employee
100 replies posted 50 replies posted 25 solutions authored

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);

0 Likes
Anonymous
Not applicable

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

0 Likes

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

0 Likes