feat: initial
This commit is contained in:
44
README.md
44
README.md
@@ -1,7 +1,40 @@
|
||||
# esp_component_template
|
||||
# ESP32 ESP-IDF component for tachometer (via rotary encoder)
|
||||
|
||||
esp_component_template
|
||||
## Tested on
|
||||
|
||||
1. [ESP32 ESP-IDF v5.5.2](https://docs.espressif.com/projects/esp-idf/en/v5.5.2/esp32/index.html)
|
||||
|
||||
## SAST Tools
|
||||
|
||||
[PVS-Studio](https://pvs-studio.com/pvs-studio/?utm_source=website&utm_medium=github&utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code.
|
||||
|
||||
## Attention
|
||||
|
||||
1. For correct operation, please enable the following settings in the menuconfig:
|
||||
|
||||
```text
|
||||
PCNT_CTRL_FUNC_IN_IRAM
|
||||
PCNT_ISR_IRAM_SAF
|
||||
```
|
||||
|
||||
## Using
|
||||
|
||||
In an existing project, run the following command to install the components:
|
||||
|
||||
```text
|
||||
cd ../your_project/components
|
||||
git clone http://git.zh.com.ru/esp_components/zh_tachometer
|
||||
```
|
||||
|
||||
In the application, add the component:
|
||||
|
||||
```c
|
||||
#include "zh_tachometer.h"
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```c
|
||||
#include "zh_tachometer.h"
|
||||
|
||||
zh_tachometer_handle_t tachometer_handle = {0};
|
||||
@@ -16,9 +49,10 @@ void app_main(void)
|
||||
zh_tachometer_init(&config, &tachometer_handle);
|
||||
for (;;)
|
||||
{
|
||||
int16_t value = 0;
|
||||
uint16_t value = 0;
|
||||
zh_tachometer_get(&tachometer_handle, &value);
|
||||
printf("Tachometer value is %d rpm.\n", value);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user