Where can I find documentation for GPIO_DRV_PinIntEnable() and corresponding function?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Where can I find documentation for GPIO_DRV_PinIntEnable() and corresponding function?

Jump to solution
590 Views
davepfaltzgraff
Senior Contributor I

More specifically, is there a function that will tell me if an interrupt has already been enabled for a pin?

 

In this case, I have two pins on Port B used for interrupts. If an interrupt occurs, I want to know if the corresponding interrupt has been set. If not, I can safely ignore the flag.

 

Thanks

Labels (1)
0 Kudos
1 Solution
422 Views
davepfaltzgraff
Senior Contributor I

Hi Alice,

I understand what you are trying to say and that's how I started the code. However, what I found was that, if I have two pins on the same port that are to be used for interrupts, all interrupts came into the same ISR and that the GPIO_DRV_PinIntEnable() routine enables for all pins on the port. That made the situation difficult as there are times when I wanted to ignore any activity on some of the pins. Essentially, I wanted one pin active or another. My solution was to define the pin as an input, but with the interrupt property set to kPortIntDisabled. Then when I want to handle input from that port I used:

PORT_HAL_SetPinIntMode(RTC_Port, GPIO_EXTRACT_PIN(RTC_Pin), kPortIntFallingEdge);

routine. It's sort of a hack as all other manipulation with this pin is done with the GPIO or GAL routines. But this works for me.

Thanks

View solution in original post

0 Kudos
3 Replies
422 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello David,

In KSDK , Enable a specific pin interrupt in GPIO initialization structures.

For example :

pastedImage_0.png

Does this answer can help you ?

BR

Alice

0 Kudos
423 Views
davepfaltzgraff
Senior Contributor I

Hi Alice,

I understand what you are trying to say and that's how I started the code. However, what I found was that, if I have two pins on the same port that are to be used for interrupts, all interrupts came into the same ISR and that the GPIO_DRV_PinIntEnable() routine enables for all pins on the port. That made the situation difficult as there are times when I wanted to ignore any activity on some of the pins. Essentially, I wanted one pin active or another. My solution was to define the pin as an input, but with the interrupt property set to kPortIntDisabled. Then when I want to handle input from that port I used:

PORT_HAL_SetPinIntMode(RTC_Port, GPIO_EXTRACT_PIN(RTC_Pin), kPortIntFallingEdge);

routine. It's sort of a hack as all other manipulation with this pin is done with the GPIO or GAL routines. But this works for me.

Thanks

0 Kudos
422 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello David:

Good to know you found the solution. For your case with only one pin active then your approach is correct. As mentioned by Alice the driver takes initialization from the GPIO pins structures, but for updating the configuration at runtime then the easiest way is with the HAL or by modifying the pin's structure and calling GPIO_DRV_InputPinInit() or GPIO_DRV_OutputPinInit().

When having more than 1 pin of the same port with interrupts enabled, then inside the ISR you can check the corresponding flags with GPIO_DRV_IsPinIntPending().

Regards!
Jorge Gonzalez

0 Kudos