diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fbc965..9a488c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1 +1,6 @@ -idf_component_register(SRCS "zh_encoder.c" INCLUDE_DIRS "include" REQUIRES esp_event driver esp_timer) \ No newline at end of file +if(${IDF_VERSION_MAJOR} STREQUAL 6) + set(requires esp_driver_gpio esp_driver_pcnt esp_timer esp_event) +else() + set(requires driver esp_timer esp_event) +endif() +idf_component_register(SRCS "zh_encoder.c" INCLUDE_DIRS "include" REQUIRES ${requires}) \ No newline at end of file diff --git a/README.md b/README.md index ad06fe0..901dec1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Tested on -1. [ESP32 ESP-IDF v5.5.3](https://docs.espressif.com/projects/esp-idf/en/v5.5.3/esp32/index.html) +1. [ESP32 ESP-IDF v6.0.0](https://docs.espressif.com/projects/esp-idf/en/v6.0/esp32/index.html) ## SAST Tools @@ -10,7 +10,7 @@ ## Features -1. Support some encoders on one device. +1. Support up to 8 encoders on one device. ## Attention diff --git a/version.txt b/version.txt index a625450..9183195 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.3.1 \ No newline at end of file +2.4.0 \ No newline at end of file diff --git a/zh_encoder.c b/zh_encoder.c index 075d9ef..5667639 100644 --- a/zh_encoder.c +++ b/zh_encoder.c @@ -22,7 +22,7 @@ static portMUX_TYPE _spinlock = portMUX_INITIALIZER_UNLOCKED; volatile static uint8_t _encoder_counter = 0; static zh_encoder_stats_t _stats = {0}; -volatile static uint8_t _encoder_number_matrix[CONFIG_SOC_PCNT_UNITS_PER_GROUP] = {0}; +volatile static uint8_t _encoder_number_matrix[8] = {0}; static esp_err_t _zh_encoder_validate_config(const zh_encoder_init_config_t *config, zh_encoder_handle_t *handle); static esp_err_t _zh_encoder_pcnt_init(const zh_encoder_init_config_t *config, zh_encoder_handle_t *handle);