Espressif ESP32-S2 Programming Manual page 342

Table of Contents

Advertisement

Chapter 2. API Reference
Application Example
• Pulse counter with control signal and event interrupt example: peripherals/pcnt/pulse_count_event.
• Parse the signal generated from rotary encoder: peripherals/pcnt/rotary_encoder.
API Reference
Header File
components/driver/include/driver/pcnt.h
Functions
esp_err_t
pcnt_unit_config(const
Configure Pulse Counter unit.
Note This
function
PCNT_EVT_ZERO.
Return
• ESP_OK Success
• ESP_ERR_INVALID_STATE pcnt driver already initialized
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• pcnt_config: Pointer of Pulse Counter unit configure parameter
esp_err_t pcnt_get_counter_value(pcnt_unit_t
Get pulse counter value.
Return
• ESP_OK Success
• ESP_ERR_INVALID_STATE pcnt driver has not been initialized
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• pcnt_unit: Pulse Counter unit number
• count: Pointer to accept counter value
esp_err_t pcnt_counter_pause(pcnt_unit_t
Pause PCNT counter of PCNT unit.
Return
• ESP_OK Success
• ESP_ERR_INVALID_STATE pcnt driver has not been initialized
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• pcnt_unit: PCNT unit number
esp_err_t pcnt_counter_resume(pcnt_unit_t
Resume counting for PCNT counter.
Return
• ESP_OK Success
• ESP_ERR_INVALID_STATE pcnt driver has not been initialized
• ESP_ERR_INVALID_ARG Parameter error
Parameters
• pcnt_unit: PCNT unit number, select from pcnt_unit_t
esp_err_t pcnt_counter_clear(pcnt_unit_t
Clear and reset PCNT counter value to zero.
Return
• ESP_OK Success
• ESP_ERR_INVALID_STATE pcnt driver has not been initialized
• ESP_ERR_INVALID_ARG Parameter error
Espressif Systems
pcnt_config_t
will
disable
three
events:
pcnt_unit, int16_t *count)
pcnt_unit)
pcnt_unit)
pcnt_unit)
331
Submit Document Feedback
*pcnt_config)
PCNT_EVT_L_LIM,
PCNT_EVT_H_LIM,
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF