sigmadelta: change gpio number from u8 to int

Fix the issue that macro compares unsigned to 0
This commit is contained in:
morris 2022-03-26 16:50:35 +08:00
parent 29e9b5b46a
commit bf677182a6
4 changed files with 8 additions and 10 deletions

View File

@ -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"

View File

@ -6,7 +6,8 @@
#pragma once
#include "esp_types.h"
#include <stdint.h>
#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;
/**

View File

@ -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"

View File

@ -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"