Output pin interrupt type GPIO_INTR_POSEDGE behaves like GPIO_INTR_ANYEDGE
Posted: Tue Jan 30, 2018 2:54 pm
Hi,
Environment: the latest ESP-IDF from Github and the board Adafruit HUZZAH32 (rev1) and a sensor such as the KY-032 Obstacle avoidance sensor, the SW-180 Tilt Sensor, SW-420 Vibration Sensor which all output a digital signal 0 or 1.
I have configured the output pin interrupt type as GPIO_INTR_POSEDGE and I would expect that the interrupt handler is only triggered when the signal goes from 0 to 1.
However, the interrupt handler is also triggered when the signal goes from 1 to 0 (the logic of GPIO_INTR_ANYEDGE).
How can I declare the interrupt handler to execute only when the signal goes from 0 to 1?
Gist:
https://gist.github.com/pantaluna/78f15 ... 05b6c11db6
-
Thanks,
Paul.
Environment: the latest ESP-IDF from Github and the board Adafruit HUZZAH32 (rev1) and a sensor such as the KY-032 Obstacle avoidance sensor, the SW-180 Tilt Sensor, SW-420 Vibration Sensor which all output a digital signal 0 or 1.
I have configured the output pin interrupt type as GPIO_INTR_POSEDGE and I would expect that the interrupt handler is only triggered when the signal goes from 0 to 1.
Code: Select all
io_conf.pin_bit_mask = (1ULL << GPIO_NUM_SENSOR);
io_conf.mode = GPIO_MODE_INPUT;
io_conf.pull_up_en = GPIO_PULLUP_ENABLE;
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
// @okay GPIO_INTR_ANYEDGE @problem GPIO_INTR_POSEDGE GPIO_INTR_NEGEDGE (they both behave the same as ANYEDGE!)
io_conf.intr_type = GPIO_INTR_POSEDGE;
ESP_ERROR_CHECK(gpio_config(&io_conf));
How can I declare the interrupt handler to execute only when the signal goes from 0 to 1?
Gist:
https://gist.github.com/pantaluna/78f15 ... 05b6c11db6
-
Thanks,
Paul.