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

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

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.

1 Like