2026-02-01 09:34:54 +03:00
2026-02-01 09:34:54 +03:00
2026-01-30 16:00:14 +03:00
2026-01-31 23:21:25 +03:00
2026-01-30 16:00:14 +03:00
2026-02-01 09:34:54 +03:00
2026-02-01 09:34:54 +03:00
2026-02-01 09:34:54 +03:00

ESP32 ESP-IDF component for tachometer (via rotary encoder)

Tested on

  1. ESP32 ESP-IDF v5.5.2

SAST Tools

PVS-Studio - static analyzer for C, C++, C#, and Java code.

Attention

  1. For correct operation, please enable the following settings in the menuconfig:
PCNT_CTRL_FUNC_IN_IRAM
PCNT_ISR_IRAM_SAF

Using

In an existing project, run the following command to install the components:

cd ../your_project/components
git clone http://git.zh.com.ru/esp_components/zh_tachometer

In the application, add the component:

#include "zh_tachometer.h"

Examples

#include "zh_tachometer.h"

zh_tachometer_handle_t tachometer_handle = {0};

void app_main(void)
{
    esp_log_level_set("zh_tachometer", ESP_LOG_ERROR);
    zh_tachometer_init_config_t config = ZH_TACHOMETER_INIT_CONFIG_DEFAULT();
    config.a_gpio_number = GPIO_NUM_26;
    config.b_gpio_number = GPIO_NUM_27;
    config.encoder_pulses = 3600;
    zh_tachometer_init(&config, &tachometer_handle);
    for (;;)
    {
        uint16_t value = 0;
        zh_tachometer_get(&tachometer_handle, &value);
        printf("Tachometer value is %d rpm.\n", value);
        vTaskDelay(100 / portTICK_PERIOD_MS);
    }
}
Description
No description provided
Readme 40 KiB
Languages
CMake 100%