EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #342 background imageLoading...
Page #342 background image
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 pcnt_config_t *pcnt_config)
Configure Pulse Counter unit.
Note This function will disable three events: PCNT_EVT_L_LIM, PCNT_EVT_H_LIM,
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 pcnt_unit, int16_t *count)
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 pcnt_unit)
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 pcnt_unit)
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 pcnt_unit)
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 331
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish