I just recently implemented PCNT in my firmware. I had to do some trial and error to get access to pcnt.h
, and I’ll document what worked for me in case others are searching.
This is applicable to my version of Mongoose OS, which is 2.18.0 (ESP-IDF 3.3).
In mos.yml, add the following under build_vars:
ESP_IDF_EXTRA_COMPONENTS: PCNT
Note that PCNT does not have its own directory like bt
does, as it lives in the driver
folder with a bunch of other components.
In the header where I need access to pcnt.h
:
#include "driver/pcnt.h"
When implementing, be sure you are referencing the correct ESP-IDF version in the docs! The PCNT bits have changed quite a bit over the last couple of years.