Using PCNT as both filter and interrupt trigger
Posted: Wed May 24, 2023 8:36 am
Hi all,
I have been planning some code but along the way I've discovered the Pulse Counter (PCNT) and I'm wondering if there's a simpler way...
- Objective - When an input goes to High, and the pulse is at least 50ms long, record that as an event and include the timestamp (microseconds).
- Previous intent - Capturing all events and using a queue whilst comparing timestamps to filter out pulses that were under 50ms
- Potentially a better way? - Use PCNT, with the interrupt adding the timestamp to the queue, and a glitch filter with a max of 50ms
Would this be a better approach? Very new to ESP32.
Thanks.
I have been planning some code but along the way I've discovered the Pulse Counter (PCNT) and I'm wondering if there's a simpler way...
- Objective - When an input goes to High, and the pulse is at least 50ms long, record that as an event and include the timestamp (microseconds).
- Previous intent - Capturing all events and using a queue whilst comparing timestamps to filter out pulses that were under 50ms
- Potentially a better way? - Use PCNT, with the interrupt adding the timestamp to the queue, and a glitch filter with a max of 50ms
Would this be a better approach? Very new to ESP32.
Thanks.