File espos_pcnt.h¶
FileList > espos_sensors > include > espos_pcnt.h
Go to the source code of this file
#include <stdbool.h>#include <stdint.h>#include "esp_err.h"
Classes¶
| Type | Name |
|---|---|
| struct | espos_pcnt_cfg_t |
Public Types¶
| Type | Name |
|---|---|
| typedef struct espos_pcnt * | espos_pcnt_handle_t |
Public Functions¶
| Type | Name |
|---|---|
| void | espos_pcnt_close (espos_pcnt_handle_t h) |
| esp_err_t | espos_pcnt_open (const espos_pcnt_cfg_t * cfg, espos_pcnt_handle_t * out) |
| void | espos_pcnt_set_total (espos_pcnt_handle_t h, uint64_t total) Set the running total (restoring one saved across a reboot). |
| bool | espos_pcnt_supported (void) True when the counting is done by the PCNT peripheral rather than an ISR. |
| esp_err_t | espos_pcnt_take (espos_pcnt_handle_t h, uint32_t * out_count, uint64_t * out_us) Edges since the previous call, and the microseconds those edges span. |
| uint64_t | espos_pcnt_total (espos_pcnt_handle_t h) Total edges since open(), for a running total that is not rate. |
Public Types Documentation¶
typedef espos_pcnt_handle_t¶
Public Functions Documentation¶
function espos_pcnt_close¶
function espos_pcnt_open¶
function espos_pcnt_set_total¶
Set the running total (restoring one saved across a reboot).
function espos_pcnt_supported¶
True when the counting is done by the PCNT peripheral rather than an ISR.
function espos_pcnt_take¶
Edges since the previous call, and the microseconds those edges span.
Returning the interval alongside the count is what makes a frequency honest: dividing by the nominal poll period assumes the poll was on time, and the first reading after a reconnect or a garbage-collecting flash write is exactly when it was not. us is measured between successive calls, so count / (us / 1e6) is the true average rate over the window.
The first call after open() returns whatever accumulated since open and an interval measured from open.
function espos_pcnt_total¶
Total edges since open(), for a running total that is not rate.
The documentation for this class was generated from the following file espos_sensors/include/espos_pcnt.h