I'm trying to build a small device using the ESP32-C3 running Arduino core.
From the documentation it appears the ESP32's have built-in hardware 'glitch filters' which I understand to filter out bounce usually associated with things like physical switches and handled via 'debounce' code. I can see this would be particularly useful when using that input as an interrupt or wakeup source as a software filter wouldn't be effective in that scenario.
When trying to use this and built my project:
gpio_new_pin_glitch_filter(GPIO_PIN);
I get the error:
'gpio_new_pin_glitch_filter' was not declared in this scope
It looks like this type of functionality is available on most ESP32 devices. All I can think is that Arduino platform for ESP32 does not include handlers for this functionality. If that's the case is there a way I can still leverage this feature in my Arduino project?
The function
gpio_new_pin_glitch_filter()
appears to have been added to ESP-IDF version 5.1. At the time this question was asked the current version of the Arduino framework was v2.0.14 which is based on ESP-IDF v4.4.6. This function wasn't available in that version of ESP-IDF and therefore won't be available to Arduino programs using this version of the framework.If you want to call
gpio_new_pin_glitch_filter()
from your Arduino program, you'll need to use a version of the Arduino framework that's built on a version of ESP-IDF that includes the function. That doesn't exist yet. Your options would be to back portgpio_new_pin_glitch_filter()
to ESP-IDF v4.4.6 or to rewrite your application to directly run on ESP-IDF 5.1 rather than the Arduino framework.