fix(gpio): fix ESP32 GPIO sleep mode handling

The previous workaround does not work, the backup/restore should apply to RTC IO registers.
Also moved the workaround to sleep_gpio.c to avoid gpio hal using kconfig.
This commit is contained in:
Song Ruo Jing
2025-08-01 16:12:26 +08:00
parent 72cb973022
commit 9a2984b4c0
27 changed files with 87 additions and 243 deletions

View File

@@ -1,13 +1,4 @@
menu "ESP-Driver:GPIO Configurations"
config GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
bool "Support light sleep GPIO pullup/pulldown configuration for ESP32"
depends on IDF_TARGET_ESP32
help
This option is intended to fix the bug that ESP32 is not able to switch to configured
pullup/pulldown mode in sleep.
If this option is selected, chip will automatically emulate the behaviour of switching,
and about 450B of source codes would be placed into IRAM.
config GPIO_CTRL_FUNC_IN_IRAM
bool "Place GPIO control functions into IRAM"
default n

View File

@@ -6,7 +6,6 @@
#pragma once
#include "sdkconfig.h"
#include "esp_types.h"
#include "soc/soc_caps.h"
#include "soc/io_mux_reg.h"
@@ -16,30 +15,6 @@
extern "C" {
#endif
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
/**
* @brief Emulate ESP32S2 behaviour to backup FUN_PU, FUN_PD information
*
* @note Need to be called before sleep.
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG GPIO number error
*/
esp_err_t gpio_sleep_pupd_config_apply(gpio_num_t gpio_num);
/**
* @brief Emulate ESP32S2 behaviour to restore FUN_PU, FUN_PD information
*
* @note Need to be called after sleep.
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG GPIO number error
*/
esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num);
#endif
/**
* @brief Configure a pin to perform GPIO function or an IOMUX function
*

View File

@@ -1011,22 +1011,6 @@ esp_err_t gpio_sleep_sel_dis(gpio_num_t gpio_num)
return ESP_OK;
}
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
esp_err_t gpio_sleep_pupd_config_apply(gpio_num_t gpio_num)
{
GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
gpio_hal_sleep_pupd_config_apply(gpio_context.gpio_hal, gpio_num);
return ESP_OK;
}
esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num)
{
GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
gpio_hal_sleep_pupd_config_unapply(gpio_context.gpio_hal, gpio_num);
return ESP_OK;
}
#endif // CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP && SOC_DEEP_SLEEP_SUPPORTED
esp_err_t gpio_deep_sleep_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type)
{

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -18,8 +18,7 @@ extern "C" {
* This file contains declarations of GPIO related functions in sleep modes.
*/
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
#if CONFIG_IDF_TARGET_ESP32
/**
* @brief Save GPIO pull-up and pull-down configuration information in the wake-up state
*
@@ -29,7 +28,7 @@ extern "C" {
* of all GPIO pull-up and pull-down resistors and disable the pull-up and
* pull-down resistors of GPIO before the system enters sleep.
*/
void gpio_sleep_mode_config_apply(void);
void esp_sleep_gpio_pupd_config_workaround_apply(void);
/**
* @brief Restore GPIO pull-up and pull-down configuration information in the wake-up state
@@ -37,9 +36,9 @@ void gpio_sleep_mode_config_apply(void);
* In light sleep mode, after the system wakes up, it needs to restore all GPIO
* pull-up and pull-down configurations before the last sleep.
*/
void gpio_sleep_mode_config_unapply(void);
void esp_sleep_gpio_pupd_config_workaround_unapply(void);
#endif // CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
#endif // CONFIG_IDF_TARGET_ESP32
/**
* @brief Call once in startup to disable the wakeup IO pins and release their holding state after waking up from Deep-sleep

View File

@@ -34,21 +34,64 @@
static const char *TAG = "sleep_gpio";
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
void gpio_sleep_mode_config_apply(void)
#if CONFIG_IDF_TARGET_ESP32
/* On ESP32, for IOs with RTC functionality, setting SLP_PU, SLP_PD couldn't change IO status
* from FUN_PU, FUN_PD to SLP_PU, SLP_PD at sleep.
*/
typedef struct gpio_slp_mode_cfg {
volatile uint32_t fun_pu;
volatile uint32_t fun_pd;
} gpio_slp_mode_cfg_t;
static DRAM_ATTR gpio_slp_mode_cfg_t gpio_cfg = {};
void esp_sleep_gpio_pupd_config_workaround_apply(void)
{
/* Record fun_pu and fun_pd state in bitmap */
for (gpio_num_t gpio_num = GPIO_NUM_0; gpio_num < GPIO_NUM_MAX; gpio_num++) {
if (GPIO_IS_VALID_GPIO(gpio_num)) {
gpio_sleep_pupd_config_apply(gpio_num);
int rtcio_num = rtc_io_num_map[gpio_num];
if (rtcio_num >= 0 && gpio_ll_sleep_sel_is_enabled(&GPIO, gpio_num)) {
if (rtcio_ll_is_pullup_enabled(rtcio_num)) {
gpio_cfg.fun_pu |= BIT(rtcio_num);
} else {
gpio_cfg.fun_pu &= ~BIT(rtcio_num);
}
if (rtcio_ll_is_pulldown_enabled(rtcio_num)) {
gpio_cfg.fun_pd |= BIT(rtcio_num);
} else {
gpio_cfg.fun_pd &= ~BIT(rtcio_num);
}
if (gpio_ll_sleep_pullup_is_enabled(&GPIO, gpio_num)) {
rtcio_ll_pullup_enable(rtcio_num);
} else {
rtcio_ll_pullup_disable(rtcio_num);
}
if (gpio_ll_sleep_pulldown_is_enabled(&GPIO, gpio_num)) {
rtcio_ll_pulldown_enable(rtcio_num);
} else {
rtcio_ll_pulldown_disable(rtcio_num);
}
}
}
}
IRAM_ATTR void gpio_sleep_mode_config_unapply(void)
void esp_sleep_gpio_pupd_config_workaround_unapply(void)
{
/* Restore fun_pu and fun_pd state from bitmap */
for (gpio_num_t gpio_num = GPIO_NUM_0; gpio_num < GPIO_NUM_MAX; gpio_num++) {
if (GPIO_IS_VALID_GPIO(gpio_num)) {
gpio_sleep_pupd_config_unapply(gpio_num);
int rtcio_num = rtc_io_num_map[gpio_num];
if (rtcio_num >= 0 && gpio_ll_sleep_sel_is_enabled(&GPIO, gpio_num)) {
if (gpio_cfg.fun_pu & BIT(rtcio_num)) {
rtcio_ll_pullup_enable(rtcio_num);
} else {
rtcio_ll_pullup_disable(rtcio_num);
}
if (gpio_cfg.fun_pd & BIT(rtcio_num)) {
rtcio_ll_pulldown_enable(rtcio_num);
} else {
rtcio_ll_pulldown_disable(rtcio_num);
}
}
}
}

View File

@@ -733,8 +733,8 @@ static SLEEP_FN_ATTR void misc_modules_sleep_prepare(uint32_t sleep_flags, bool
# endif
mac_bb_power_down_cb_execute();
#endif
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
gpio_sleep_mode_config_apply();
#if CONFIG_IDF_TARGET_ESP32
esp_sleep_gpio_pupd_config_workaround_apply();
#endif
#if CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP && SOC_PM_CPU_RETENTION_BY_RTCCNTL
sleep_enable_cpu_retention();
@@ -801,8 +801,8 @@ static SLEEP_FN_ATTR void misc_modules_wake_prepare(uint32_t sleep_flags)
#if CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP && SOC_PM_CPU_RETENTION_BY_RTCCNTL
sleep_disable_cpu_retention();
#endif
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
gpio_sleep_mode_config_unapply();
#if CONFIG_IDF_TARGET_ESP32
esp_sleep_gpio_pupd_config_workaround_unapply();
#endif
#if CONFIG_MAC_BB_PD
mac_bb_power_up_cb_execute();

View File

@@ -86,8 +86,6 @@ menu "Power Management"
you can call 'gpio_sleep_sel_dis' to disable this feature on those pins.
You can also keep this feature on and call 'gpio_sleep_set_direction' and 'gpio_sleep_set_pull_mode'
to have a different GPIO configuration at sleep.
Warning: If you want to enable this option on ESP32, you should enable `GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL`
at first, otherwise you will not be able to switch pullup/pulldown mode.
config PM_SLP_DEFAULT_PARAMS_OPT
bool

View File

@@ -23,8 +23,9 @@ entries:
if ESP_PHY_MAC_BB_PD = y:
sleep_modem:mac_bb_power_down_cb_execute (noflash)
sleep_modem:mac_bb_power_up_cb_execute (noflash)
if GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL = y:
sleep_gpio:gpio_sleep_mode_config_apply (noflash)
if IDF_TARGET_ESP32 = y:
sleep_gpio:esp_sleep_gpio_pupd_config_workaround_apply (noflash)
sleep_gpio:esp_sleep_gpio_pupd_config_workaround_unapply (noflash)
if SOC_PM_SUPPORT_TOP_PD = y:
sleep_clock:clock_domain_pd_allowed (noflash)
sleep_system_peripheral:peripheral_domain_pd_allowed (noflash)
@@ -80,24 +81,9 @@ entries:
esp_time_impl:esp_time_impl_get_boot_time (noflash)
esp_time_impl:esp_set_time_from_rtc (noflash)
[mapping:driver_pm]
archive: libesp_driver_gpio.a
entries:
if GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL = y:
gpio:gpio_sleep_pupd_config_unapply (noflash)
if PM_SLP_IRAM_OPT = y:
gpio:gpio_sleep_pupd_config_apply (noflash)
[mapping:hal_pm]
archive: libhal.a
entries:
if GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL = y:
if PM_SLP_IRAM_OPT = y:
gpio_hal_workaround (noflash)
else:
gpio_hal_workaround:gpio_hal_sleep_pupd_config_unapply (noflash)
gpio_hal_workaround:gpio_hal_sleep_mode_setup_wrapper (noflash)
gpio_hal_workaround:gpio_hal_fun_pupd_restore (noflash)
if SOC_PM_CPU_RETENTION_BY_RTCCNTL = y:
if PM_SLP_IRAM_OPT = y && PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP = y:
rtc_cntl_hal:rtc_cntl_hal_enable_cpu_retention (noflash)

View File

@@ -325,11 +325,6 @@ elseif(NOT BOOTLOADER_BUILD)
list(APPEND srcs "touch_sens_hal.c")
endif()
if(${target} STREQUAL "esp32")
list(APPEND srcs
"esp32/gpio_hal_workaround.c")
endif()
if(${target} STREQUAL "esp32s2")
list(APPEND srcs
"xt_wdt_hal.c"

View File

@@ -1,111 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
// The HAL layer for GPIO (common part)
//
#include "esp_attr.h"
#include "soc/soc.h"
#include "hal/gpio_hal.h"
#include "soc/soc_caps.h"
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
typedef struct gpio_slp_mode_cfg {
volatile uint16_t fun_pu[((SOC_GPIO_PIN_COUNT-1) >> 4) + 1];
volatile uint16_t fun_pd[((SOC_GPIO_PIN_COUNT-1) >> 4) + 1];
} gpio_slp_mode_cfg_t;
static void gpio_hal_sleep_mode_setup_wrapper(
gpio_hal_context_t *hal,
uint32_t gpio_num,
void (*opt)(gpio_hal_context_t *, uint32_t, void *)
)
{
static DRAM_ATTR gpio_slp_mode_cfg_t gpio_cfg;
if (opt) {
(*opt)(hal, gpio_num, (void *)&gpio_cfg);
}
}
/**
* @brief GPIO pu/pd information backup function
* @param hal gpio hal
* @param gpio_num gpio num
* @param args pointer for bitmap to backup GPIO pu/pd information
*/
static void gpio_hal_fun_pupd_backup(gpio_hal_context_t *hal, uint32_t gpio_num, void *args)
{
/* On ESP32, setting SLP_PU, SLP_PD couldn`t change GPIO status
* from FUN_PU, FUN_PD to SLP_PU, SLP_PD at sleep.
* On the ESP32S2, it does.
* The following code emulates ESP32S2`s behavior:
*/
gpio_slp_mode_cfg_t *pcfg = (gpio_slp_mode_cfg_t *)args;
if (gpio_ll_sleep_sel_is_enabled(hal->dev, gpio_num)) {
/* Record fun_pu and fun_pd state in bitmap */
if (gpio_ll_pullup_is_enabled(hal->dev, gpio_num)) {
pcfg->fun_pu[gpio_num >> 4] |= BIT(gpio_num & 0xf);
} else {
pcfg->fun_pu[gpio_num >> 4] &= ~BIT(gpio_num & 0xf);
}
if (gpio_ll_pulldown_is_enabled(hal->dev, gpio_num)) {
pcfg->fun_pd[gpio_num >> 4] |= BIT(gpio_num & 0xf);
} else {
pcfg->fun_pd[gpio_num >> 4] &= ~BIT(gpio_num & 0xf);
}
if (gpio_ll_sleep_pullup_is_enabled(hal->dev, gpio_num)) {
gpio_ll_pullup_en(hal->dev, gpio_num);
} else {
gpio_ll_pullup_dis(hal->dev, gpio_num);
}
if (gpio_ll_sleep_pulldown_is_enabled(hal->dev, gpio_num)) {
gpio_ll_pulldown_en(hal->dev, gpio_num);
} else {
gpio_ll_pulldown_dis(hal->dev, gpio_num);
}
}
}
/**
* @brief GPIO pu/pd information backup function
* @param hal gpio hal
* @param gpio_num gpio num
* @param args pointer for bitmap to restore GPIO pu/pd information
*/
static void gpio_hal_fun_pupd_restore(gpio_hal_context_t *hal, uint32_t gpio_num, void *args)
{
/* On ESP32, setting SLP_PU, SLP_PD couldn`t change GPIO status
* from SLP_PU, SLP_PD to FUN_PU, FUN_PD when it wakes up.
* On the ESP32S2, it does.
* The following code emulates ESP32S2`s behavior:
*/
gpio_slp_mode_cfg_t *pcfg = (gpio_slp_mode_cfg_t *)args;
if (gpio_ll_sleep_sel_is_enabled(hal->dev, gpio_num)) {
if (pcfg->fun_pu[gpio_num >> 4] & BIT(gpio_num & 0xf)) {
gpio_ll_pullup_en(hal->dev, gpio_num);
} else {
gpio_ll_pullup_dis(hal->dev, gpio_num);
}
if (pcfg->fun_pd[gpio_num >> 4] & BIT(gpio_num & 0xf)) {
gpio_ll_pulldown_en(hal->dev, gpio_num);
} else {
gpio_ll_pulldown_dis(hal->dev, gpio_num);
}
}
}
void gpio_hal_sleep_pupd_config_apply(gpio_hal_context_t *hal, uint32_t gpio_num)
{
gpio_hal_sleep_mode_setup_wrapper(hal, gpio_num, gpio_hal_fun_pupd_backup);
}
void gpio_hal_sleep_pupd_config_unapply(gpio_hal_context_t *hal, uint32_t gpio_num)
{
gpio_hal_sleep_mode_setup_wrapper(hal, gpio_num, gpio_hal_fun_pupd_restore);
}
#endif

View File

@@ -173,7 +173,7 @@ static inline void gpio_ll_sleep_sel_dis(gpio_dev_t *hw, uint32_t gpio_num)
__attribute__((always_inline))
static inline bool gpio_ll_sleep_sel_is_enabled(gpio_dev_t *hw, uint32_t gpio_num)
{
return REG_GET_BIT(GPIO_PIN_MUX_REG[gpio_num], SLP_SEL) ? true : false;
return REG_GET_BIT(DR_REG_IO_MUX_BASE + GPIO_PIN_MUX_REG_OFFSET[gpio_num], SLP_SEL) ? true : false;
}
/**
@@ -210,7 +210,7 @@ static inline void gpio_ll_sleep_pullup_en(gpio_dev_t *hw, uint32_t gpio_num)
__attribute__((always_inline))
static inline bool gpio_ll_sleep_pullup_is_enabled(gpio_dev_t *hw, uint32_t gpio_num)
{
return REG_GET_BIT(GPIO_PIN_MUX_REG[gpio_num], SLP_PU) ? true : false;
return REG_GET_BIT(DR_REG_IO_MUX_BASE + GPIO_PIN_MUX_REG_OFFSET[gpio_num], SLP_PU) ? true : false;
}
/**
@@ -247,7 +247,7 @@ static inline void gpio_ll_sleep_pulldown_dis(gpio_dev_t *hw, uint32_t gpio_num)
__attribute__((always_inline))
static inline bool gpio_ll_sleep_pulldown_is_enabled(gpio_dev_t *hw, uint32_t gpio_num)
{
return REG_GET_BIT(GPIO_PIN_MUX_REG[gpio_num], SLP_PD) ? true : false;
return REG_GET_BIT(DR_REG_IO_MUX_BASE + GPIO_PIN_MUX_REG_OFFSET[gpio_num], SLP_PD) ? true : false;
}
/**

View File

@@ -168,10 +168,11 @@ static inline void rtcio_ll_output_mode_set(int rtcio_num, rtcio_ll_out_mode_t m
}
/**
* RTC GPIO pullup enable.
* @brief RTC GPIO pullup enable.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
__attribute__((always_inline))
static inline void rtcio_ll_pullup_enable(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pullup) {
@@ -180,10 +181,11 @@ static inline void rtcio_ll_pullup_enable(int rtcio_num)
}
/**
* RTC GPIO pullup disable.
* @brief RTC GPIO pullup disable.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
__attribute__((always_inline))
static inline void rtcio_ll_pullup_disable(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pullup) {
@@ -197,6 +199,7 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pullup of the pad is enabled or not.
*/
__attribute__((always_inline))
static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pullup) {
@@ -207,10 +210,11 @@ static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
}
/**
* RTC GPIO pulldown enable.
* @brief RTC GPIO pulldown enable.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
__attribute__((always_inline))
static inline void rtcio_ll_pulldown_enable(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pulldown) {
@@ -219,10 +223,11 @@ static inline void rtcio_ll_pulldown_enable(int rtcio_num)
}
/**
* RTC GPIO pulldown disable.
* @brief RTC GPIO pulldown disable.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
*/
__attribute__((always_inline))
static inline void rtcio_ll_pulldown_disable(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pulldown) {
@@ -236,6 +241,7 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pulldown of the pad is enabled or not.
*/
__attribute__((always_inline))
static inline bool rtcio_ll_is_pulldown_enabled(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pulldown) {

View File

@@ -497,24 +497,6 @@ void gpio_hal_matrix_out(gpio_hal_context_t *hal, uint32_t gpio_num, uint32_t si
*/
#define gpio_hal_sleep_output_enable(hal, gpio_num) gpio_ll_sleep_output_enable((hal)->dev, gpio_num)
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
/**
* @brief Apply slp_pu/slp_pd configuration to fun_pu/fun_pd when system sleep.
*
* @param hal Context of the HAL layer
* @param gpio_num GPIO number.
*/
void gpio_hal_sleep_pupd_config_apply(gpio_hal_context_t *hal, uint32_t gpio_num);
/**
* @brief Restore fun_pu/fun_pd configuration when system wakeup.
*
* @param hal Context of the HAL layer
* @param gpio_num GPIO number.
*/
void gpio_hal_sleep_pupd_config_unapply(gpio_hal_context_t *hal, uint32_t gpio_num);
#endif // CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP && (SOC_RTCIO_PIN_COUNT == 0) && SOC_DEEP_SLEEP_SUPPORTED
/**
* @brief Enable GPIO deep-sleep wake-up function.

View File

@@ -6,8 +6,9 @@
#include "soc/rtc_periph.h"
#include "soc/rtc_io_reg.h"
#include "esp_attr.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t DRAM_ATTR rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
RTCIO_GPIO0_CHANNEL, //GPIO0
-1,//GPIO1
RTCIO_GPIO2_CHANNEL, //GPIO2

View File

@@ -6,7 +6,7 @@
#include "soc/rtc_io_periph.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
RTCIO_GPIO0_CHANNEL, //GPIO0
RTCIO_GPIO1_CHANNEL, //GPIO1
RTCIO_GPIO2_CHANNEL, //GPIO2

View File

@@ -6,7 +6,7 @@
#include "soc/rtc_io_periph.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
RTCIO_GPIO0_CHANNEL, //GPIO0
RTCIO_GPIO1_CHANNEL, //GPIO1
RTCIO_GPIO2_CHANNEL, //GPIO2

View File

@@ -6,7 +6,7 @@
#include "soc/rtc_io_periph.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
RTCIO_GPIO0_CHANNEL, //GPIO0
RTCIO_GPIO1_CHANNEL, //GPIO1
RTCIO_GPIO2_CHANNEL, //GPIO2

View File

@@ -5,7 +5,7 @@
*/
#include "soc/rtc_io_periph.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
-1,//GPIO0
-1,//GPIO1
-1,//GPIO2

View File

@@ -6,7 +6,7 @@
#include "soc/rtc_io_periph.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
-1,//GPIO0
-1,//GPIO1
-1,//GPIO2

View File

@@ -6,7 +6,7 @@
#include "soc/rtc_io_periph.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
RTCIO_GPIO0_CHANNEL, //GPIO0
RTCIO_GPIO1_CHANNEL, //GPIO1
RTCIO_GPIO2_CHANNEL, //GPIO2

View File

@@ -6,7 +6,7 @@
#include "soc/rtc_periph.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
RTCIO_GPIO0_CHANNEL, //GPIO0
RTCIO_GPIO1_CHANNEL, //GPIO1
RTCIO_GPIO2_CHANNEL, //GPIO2

View File

@@ -7,7 +7,7 @@
#include "soc/rtc_periph.h"
#include "soc/rtc_io_reg.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
RTCIO_GPIO0_CHANNEL, //GPIO0
RTCIO_GPIO1_CHANNEL, //GPIO1
RTCIO_GPIO2_CHANNEL, //GPIO2

View File

@@ -7,7 +7,7 @@
#include "soc/rtc_periph.h"
#include "soc/rtc_io_reg.h"
const int rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT] = {
RTCIO_GPIO0_CHANNEL, //GPIO0
RTCIO_GPIO1_CHANNEL, //GPIO1
RTCIO_GPIO2_CHANNEL, //GPIO2

View File

@@ -63,7 +63,7 @@ extern const rtc_io_desc_t rtc_io_desc[SOC_RTCIO_PIN_COUNT];
* This is an internal function of the driver, and is not usually useful
* for external use.
*/
extern const int rtc_io_num_map[SOC_GPIO_PIN_COUNT];
extern const int8_t rtc_io_num_map[SOC_GPIO_PIN_COUNT];
#endif //SOC_RTCIO_PIN_COUNT > 0
#ifdef __cplusplus

View File

@@ -8,12 +8,10 @@ CONFIG_FREERTOS_USE_TICKLESS_IDLE=y
CONFIG_PM_SLP_IRAM_OPT=y
CONFIG_PM_RTOS_IDLE_OPT=y
# Disable all GPIO at light sleep
CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL=y
CONFIG_PM_SLP_DISABLE_GPIO=y
# Enable wifi sleep iram optimization
CONFIG_ESP_WIFI_SLP_IRAM_OPT=y
CONFIG_ESP_GRATUITOUS_ARP=n
CONFIG_LWIP_ESP_GRATUITOUS_ARP=n
CONFIG_FREERTOS_HZ=1000

View File

@@ -8,7 +8,6 @@ CONFIG_FREERTOS_USE_TICKLESS_IDLE=y
CONFIG_PM_SLP_IRAM_OPT=y
CONFIG_PM_RTOS_IDLE_OPT=y
# Disable all GPIO at light sleep
CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL=y
CONFIG_PM_SLP_DISABLE_GPIO=y
# Enable wifi sleep iram optimization
CONFIG_ESP_WIFI_SLP_IRAM_OPT=y

View File

@@ -15,10 +15,8 @@ ignores:
- "components/hal/cache_hal.c"
- "components/hal/mmu_hal.c"
- "components/hal/twai_hal_sja1000.c"
- "components/hal/esp32/gpio_hal_workaround.c"
- "components/hal/esp32/include/hal/twai_ll.h"
- "components/hal/esp32/include/hal/uart_ll.h"
- "components/hal/include/hal/gpio_hal.h"
- "components/hal/include/hal/twai_types_deprecated.h"
rule:
any: