From c36fc3b80880ce0c126bce1a44cd09328502aace Mon Sep 17 00:00:00 2001 From: kuba Date: Sun, 18 Feb 2024 20:37:33 +0100 Subject: [PATCH] anemometer: add pulse_cnt.h header only for ESP_IDF > 5.0.0 --- components/anemometer/anemometer.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/components/anemometer/anemometer.c b/components/anemometer/anemometer.c index 132e31b9..c06b4183 100644 --- a/components/anemometer/anemometer.c +++ b/components/anemometer/anemometer.c @@ -40,11 +40,18 @@ #include #include #include -#include #include -#if HELPER_TARGET_IS_ESP32 +#if defined(HELPER_TARGET_IS_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) \ + && ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) + +#define ESP_PCNT_SUPPORTED (1) #include +#else +#define ESP_PCNT_SUPPORTED (0) +#endif + +#if HELPER_TARGET_IS_ESP32 static portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED; #define PORT_ENTER_CRITICAL() portENTER_CRITICAL(&mux) #define PORT_EXIT_CRITICAL() portEXIT_CRITICAL(&mux) @@ -57,14 +64,6 @@ static portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED; #error cannot identify the target #endif -#if defined(HELPER_TARGET_IS_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) \ - && ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) - -#define ESP_PCNT_SUPPORTED (1) -#else -#define ESP_PCNT_SUPPORTED (0) -#endif - #define CHECK_ARG(VAL) do { if (!(VAL)) return ESP_ERR_INVALID_ARG; } while (0) typedef struct {