From bf677182a69b3999c536a177062a86c86cfee5bd Mon Sep 17 00:00:00 2001 From: morris Date: Sat, 26 Mar 2022 16:50:35 +0800 Subject: [PATCH] sigmadelta: change gpio number from u8 to int Fix the issue that macro compares unsigned to 0 --- components/driver/include/driver/gpio.h | 4 ---- components/driver/include/driver/sigmadelta.h | 11 ++++++----- components/esp_pm/pm_trace.c | 2 +- .../common_components/light_driver/iot_led.c | 1 + 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index f71f47aa0c..fe01ee74d5 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -10,11 +10,7 @@ #include "sdkconfig.h" #include "esp_err.h" #include "esp_intr_alloc.h" -#if !CONFIG_IDF_TARGET_LINUX -#include "esp_attr.h" -#include "esp_types.h" #include "soc/soc_caps.h" -#endif // !CONFIG_IDF_TARGET_LINUX #include "hal/gpio_types.h" #include "esp_rom_gpio.h" diff --git a/components/driver/include/driver/sigmadelta.h b/components/driver/include/driver/sigmadelta.h index 7f7c715953..eaecead4d9 100644 --- a/components/driver/include/driver/sigmadelta.h +++ b/components/driver/include/driver/sigmadelta.h @@ -6,7 +6,8 @@ #pragma once -#include "esp_types.h" +#include +#include "esp_err.h" #include "driver/gpio.h" #include "hal/sigmadelta_types.h" @@ -18,10 +19,10 @@ extern "C" { * @brief Sigma-delta configure struct */ typedef struct { - sigmadelta_channel_t channel; /*!< Sigma-delta channel number */ - int8_t sigmadelta_duty; /*!< Sigma-delta duty, duty ranges from -128 to 127. */ - uint8_t sigmadelta_prescale; /*!< Sigma-delta prescale, prescale ranges from 0 to 255. */ - uint8_t sigmadelta_gpio; /*!< Sigma-delta output io number, refer to gpio.h for more details. */ + sigmadelta_channel_t channel; /*!< Sigma-delta channel number */ + int8_t sigmadelta_duty; /*!< Sigma-delta duty, duty ranges from -128 to 127. */ + uint8_t sigmadelta_prescale; /*!< Sigma-delta prescale, prescale ranges from 0 to 255. */ + gpio_num_t sigmadelta_gpio; /*!< Sigma-delta output io number, refer to gpio.h for more details. */ } sigmadelta_config_t; /** diff --git a/components/esp_pm/pm_trace.c b/components/esp_pm/pm_trace.c index a3dd7ed81d..3e3ab3050d 100644 --- a/components/esp_pm/pm_trace.c +++ b/components/esp_pm/pm_trace.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ - +#include "esp_attr.h" #include "esp_private/pm_trace.h" #include "driver/gpio.h" #include "soc/soc.h" diff --git a/examples/bluetooth/esp_ble_mesh/common_components/light_driver/iot_led.c b/examples/bluetooth/esp_ble_mesh/common_components/light_driver/iot_led.c index fc58015ca8..17f1831524 100644 --- a/examples/bluetooth/esp_ble_mesh/common_components/light_driver/iot_led.c +++ b/examples/bluetooth/esp_ble_mesh/common_components/light_driver/iot_led.c @@ -14,6 +14,7 @@ #include "soc/ledc_struct.h" #include "driver/gptimer.h" #include "driver/ledc.h" +#include "esp_attr.h" #include "iot_led.h" #include "esp_log.h"