Hi Brian:
You can always test the value of the GPIO with gpio_pin_read() in the callback, if it is 1, then the cause is a rising edge, and if it is 0 the cause was a falling edge. Unfortunately if the input is a very short pulse you could get a rising edge interrupt, but by the time you get around to reading the GPIO, it could be back to low giving you the wrong information, and the short pulse should also trigger a second interrupt. If your transitions are relatively slow the testing the GPIO is good enough.
I agree there should be a way to separate the rising and falling events. Did you try creating two call backs, one for rising, and one for falling?
gpio_pin_configure – with flags for rising edge gpio_init_callback, - rising gpio_add_callback, - rising gpio_pin_enable_callback – for rising edges
gpio_pin_configure – with flags for falling edge gpio_init_callback, - falling gpio_add_callback, - falling gpio_pin_enable_callback – for falling edges
Lawrence King Principal Developer +1(416)627-7302
From: users@... <users@...>
On Behalf Of bbradley@...
Sent: Thursday, December 5, 2019 11:16 AM To: users@... Subject: [Zephyr-users] Determining source of GPIO Interrupt on NRF52832 #gpio #nrf52832
Hello,
|
|