GPIO irq: Falling and Rising edge detection

2.3k Views Asked by At

I try to create bare metal application for TI am335x soc based board. One thing I need to do is to invoke callback1 on rising edge and callback2 on falling edge. From the datasheet I figured out, that simultaneous detection for rising and falling edge could be enabled by writing 1 << pin to RISINGDETECT and FALLINGDETECT GPIO registers. However, I can't understand (see no signs of it in datasheet), how could I determine if the currently appeared interrupt was caused by RISING edge on GPIO or by FALLING edge?

1

There are 1 best solutions below

0
sawdust On BEST ANSWER

how could I determine if the currently appeared interrupt was caused by RISING edge on GPIO or by FALLING edge?

Try checking the state of the pin.
A rising edge results in a on state, whereas a falling edge results in a off state.
So the current state of the pin implies the direction of the most-recent interrupt.