PlatformIO Community

attachInterrupt( ) - modes ONLOW_WE & ONHIGH_WE, how do they work?

Hello, I have searched everywhere to know how interrupts work in ONLOW_WE and ONHIGH_WE modes, but I have not been able to find anything about it.
Please does anyone know what those two interrupt modes are for?

The code and datasheet holds the truth.

the interrupt type is forwarded to these functions

which are documented at

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/gpio.html#_CPPv418gpio_set_intr_type10gpio_num_t15gpio_int_type_t

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/gpio.html#_CPPv418gpio_wakeup_enable10gpio_num_t15gpio_int_type_t

specifically the interrupt types:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/gpio.html#_CPPv415gpio_int_type_t

So ONLOW_WE maps to GPIO_INTR_LOW_LEVEL: “input low level trigger” with wakeup enabled (WE), and ONHIGH_WE to GPIO_INTR_HIGH_LEVEL: “input high level trigger” with wakeup enabled. There is also ONLOW and ONHIGH, that is without wakeup.

We can further read up on that in the technical ESP32 datasheet, specifically page 70

grafik

So, in simple words, ONLOW_WE will trigger an interrupt if the input signal level is low (not a falling edge) and wake up the ESP32 from light sleep, if it is currently in light sleep.

@maxgerhardt, this cannot be better explained and documented. Once again, thank you very much for your help.