How to install 2 interrupts (Falling/Rising) for 1 input GPIO (Switch) (MQX)

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

How to install 2 interrupts (Falling/Rising) for 1 input GPIO (Switch) (MQX)

Jump to solution
913 Views
vinhpham
Contributor I

Hi all,

I'm working on GPIO module, Vybrid Tower Board (MQX OS). I want to install 2 interrupts (falling/rising) on GPIO input switch BSP_SW1. So how to register 2 interrupt service routine on this gpio?

Thanks!

Tags (3)
1 Solution
400 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Let me see if I understand correctly. You want to install 2 different callbacks, one for rising and other for falling edge pro the BSP_SW1, right?

So far the the MQX API only supports one callback. I would do it in the next way:

1.- Install one general callback that is generated  for rising and falling edge.

2.- In that callback check the state of the pin and execute one routine or other depending on the state of the pin.

You have to keep in mind that there is one interrupt vector per PORT. Therefore you have to implement a more complex handler if you want to detect the pin that caused the interrupt.

Best Regards,

Alejandro

View solution in original post

2 Replies
401 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Let me see if I understand correctly. You want to install 2 different callbacks, one for rising and other for falling edge pro the BSP_SW1, right?

So far the the MQX API only supports one callback. I would do it in the next way:

1.- Install one general callback that is generated  for rising and falling edge.

2.- In that callback check the state of the pin and execute one routine or other depending on the state of the pin.

You have to keep in mind that there is one interrupt vector per PORT. Therefore you have to implement a more complex handler if you want to detect the pin that caused the interrupt.

Best Regards,

Alejandro

400 Views
vinhpham
Contributor I

Thank Alejandro Lozano. Your answer is good.

0 Kudos