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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
1,100件の閲覧回数
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!

タグ(3)
1 解決策
587件の閲覧回数
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

元の投稿で解決策を見る

2 返答(返信)
588件の閲覧回数
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

587件の閲覧回数
vinhpham
Contributor I

Thank Alejandro Lozano. Your answer is good.

0 件の賞賛
返信