From 54544998776b825cf847d72ad45243f051fd5708 Mon Sep 17 00:00:00 2001 From: Darian Leung <32921628+Dazza0@users.noreply.github.com> Date: Tue, 5 Aug 2025 16:30:45 +0800 Subject: [PATCH] refactor: Use enum values for gpio pull up/down fields Ensure that enum values are used When assigning `pull_up_en` and `pull_down_en` fields of `gpio_config_t`. Helps avoid `invalid conversion` errors when building those code snippets in C++. --- .../test_app_update/main/utils_update.c | 4 ++-- .../bt/common/ble_log/ble_log_spi_out.c | 4 ++-- .../isp_dvp/src/esp_cam_ctlr_isp_dvp.c | 4 ++-- .../test_apps/gpio/main/test_gpio.c | 20 +++++++++---------- .../test_apps/gpio/main/test_rtcio.c | 4 ++-- .../test_apps/parlio/main/test_parlio_rx.c | 4 ++-- .../esp_driver_sdmmc/src/sd_host_sdmmc.c | 4 ++-- components/esp_driver_sdspi/src/sdspi_host.c | 8 ++++---- .../wakeup_tests/main/src/io_wakeup_cmd.c | 8 ++++---- components/esp_phy/src/phy_common.c | 4 ++-- docs/en/api-reference/peripherals/gpio.rst | 4 ++-- docs/zh_CN/api-reference/peripherals/gpio.rst | 4 ++-- .../classic_bt/hfp_ag/main/gpio_pcm_config.c | 14 ++++++------- .../classic_bt/hfp_hf/main/gpio_pcm_config.c | 14 ++++++------- .../main/main.c | 10 +++++----- .../common_components/cte_config/cte_config.c | 4 ++-- .../mesh/ip_internal_network/main/mesh_main.c | 4 ++-- examples/network/sta2eth/main/sta2eth_main.c | 2 +- .../main/ana_cmpr_example_main.c | 4 ++-- .../generic_gpio/main/gpio_example_main.c | 8 ++++---- .../peripherals/sdio/host/main/app_main.c | 6 +++--- .../lcd/main/spi_master_example_main.c | 2 +- .../spi_slave/sender/main/app_main.c | 2 +- .../main/gptimer_capture_hc_sr04.c | 2 +- .../tusb_hid/main/tusb_hid_example_main.c | 4 ++-- examples/phy/cert_test/main/cmd_phy.c | 4 ++-- .../sdmmc/components/sd_card/sd_test_io.c | 4 ++-- .../system/light_sleep/main/gpio_wakeup.c | 4 ++-- .../HA_on_off_switch/main/switch_driver.c | 2 +- 29 files changed, 81 insertions(+), 81 deletions(-) diff --git a/components/app_update/test_apps/test_app_update/main/utils_update.c b/components/app_update/test_apps/test_app_update/main/utils_update.c index 29d12607ce..85c44df971 100644 --- a/components/app_update/test_apps/test_app_update/main/utils_update.c +++ b/components/app_update/test_apps/test_app_update/main/utils_update.c @@ -269,8 +269,8 @@ void set_output_pin(uint32_t num_pin) io_conf.intr_type = GPIO_INTR_DISABLE; io_conf.mode = GPIO_MODE_OUTPUT; io_conf.pin_bit_mask = (1ULL << num_pin); - io_conf.pull_down_en = 0; - io_conf.pull_up_en = 0; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; TEST_ESP_OK(gpio_config(&io_conf)); TEST_ESP_OK(gpio_set_level(num_pin, 0)); diff --git a/components/bt/common/ble_log/ble_log_spi_out.c b/components/bt/common/ble_log/ble_log_spi_out.c index 60247f4953..644bfc0cc5 100644 --- a/components/bt/common/ble_log/ble_log_spi_out.c +++ b/components/bt/common/ble_log/ble_log_spi_out.c @@ -860,8 +860,8 @@ static int spi_out_ts_sync_init(void) .intr_type = GPIO_INTR_DISABLE, .mode = GPIO_MODE_OUTPUT, .pin_bit_mask = BIT(SPI_OUT_SYNC_IO_NUM), - .pull_down_en = 0, - .pull_up_en = 0 + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE }; if (gpio_config(&io_conf) != ESP_OK) { goto failed; diff --git a/components/esp_driver_cam/isp_dvp/src/esp_cam_ctlr_isp_dvp.c b/components/esp_driver_cam/isp_dvp/src/esp_cam_ctlr_isp_dvp.c index 324b86ac86..865520094e 100644 --- a/components/esp_driver_cam/isp_dvp/src/esp_cam_ctlr_isp_dvp.c +++ b/components/esp_driver_cam/isp_dvp/src/esp_cam_ctlr_isp_dvp.c @@ -521,8 +521,8 @@ static esp_err_t s_isp_io_init(isp_dvp_controller_t *dvp_ctlr, const esp_cam_ctl gpio_config_t gpio_conf = { .intr_type = GPIO_INTR_DISABLE, .mode = GPIO_MODE_INPUT, - .pull_down_en = false, - .pull_up_en = true, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_ENABLE, }; if (ctlr_config->pclk_io >= 0) { diff --git a/components/esp_driver_gpio/test_apps/gpio/main/test_gpio.c b/components/esp_driver_gpio/test_apps/gpio/main/test_gpio.c index c1a4d6e43f..5700ce68b5 100644 --- a/components/esp_driver_gpio/test_apps/gpio/main/test_gpio.c +++ b/components/esp_driver_gpio/test_apps/gpio/main/test_gpio.c @@ -55,8 +55,8 @@ static gpio_config_t test_init_io(gpio_num_t num) .intr_type = GPIO_INTR_DISABLE, .mode = GPIO_MODE_OUTPUT, .pin_bit_mask = (1ULL << num), - .pull_down_en = 0, - .pull_up_en = 0, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE, }; return io_conf; } @@ -68,7 +68,7 @@ static void test_gpio_config_mode_input_output(gpio_num_t num) { gpio_config_t input_output_io = test_init_io(num); input_output_io.mode = GPIO_MODE_INPUT_OUTPUT; - input_output_io.pull_up_en = 1; + input_output_io.pull_up_en = GPIO_PULLUP_ENABLE; TEST_ESP_OK(gpio_config(&input_output_io)); } @@ -813,8 +813,8 @@ TEST_CASE("GPIO_input_and_output_of_USB_pins_test", "[gpio]") .intr_type = GPIO_INTR_DISABLE, .mode = GPIO_MODE_INPUT_OUTPUT, .pin_bit_mask = BIT64(pin), - .pull_down_en = 0, - .pull_up_en = 0, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE, }; gpio_config(&io_conf); @@ -856,8 +856,8 @@ TEST_CASE("GPIO_USB_DP_pin_pullup_disable_test", "[gpio]") int pin = test_pins[i]; gpio_config_t input_io = test_init_io(pin); input_io.mode = GPIO_MODE_INPUT; - input_io.pull_up_en = 0; - input_io.pull_down_en = 1; + input_io.pull_up_en = GPIO_PULLUP_DISABLE; + input_io.pull_down_en = GPIO_PULLDOWN_ENABLE; gpio_config(&input_io); TEST_ASSERT_EQUAL_INT(0, gpio_get_level(pin)); @@ -871,7 +871,7 @@ TEST_CASE("GPIO_light_sleep_wake_up_test", "[gpio][ignore]") { gpio_config_t io_config = test_init_io(TEST_GPIO_INPUT_LEVEL_LOW_PIN); io_config.mode = GPIO_MODE_INPUT; - io_config.pull_down_en = 1; + io_config.pull_down_en = GPIO_PULLDOWN_ENABLE; gpio_config(&io_config); TEST_ESP_OK(gpio_wakeup_enable(TEST_GPIO_INPUT_LEVEL_LOW_PIN, GPIO_INTR_HIGH_LEVEL)); TEST_ESP_OK(esp_sleep_enable_gpio_wakeup()); @@ -898,8 +898,8 @@ static void gpio_deep_sleep_hold_test_first_stage(void) .intr_type = GPIO_INTR_DISABLE, .mode = GPIO_MODE_INPUT_OUTPUT, .pin_bit_mask = (1ULL << io_num), - .pull_down_en = 0, - .pull_up_en = 0, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE, }; TEST_ESP_OK(gpio_config(&io_conf)); TEST_ESP_OK(gpio_set_level(io_num, 0)); diff --git a/components/esp_driver_gpio/test_apps/gpio/main/test_rtcio.c b/components/esp_driver_gpio/test_apps/gpio/main/test_rtcio.c index 6903838280..3a8e2697c8 100644 --- a/components/esp_driver_gpio/test_apps/gpio/main/test_rtcio.c +++ b/components/esp_driver_gpio/test_apps/gpio/main/test_rtcio.c @@ -294,8 +294,8 @@ static void rtcio_deep_sleep_hold_test_first_stage(void) .intr_type = GPIO_INTR_DISABLE, .mode = GPIO_MODE_INPUT_OUTPUT, .pin_bit_mask = (1ULL << io_num), - .pull_down_en = 0, - .pull_up_en = 0, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE, }; gpio_config(&io_conf); diff --git a/components/esp_driver_parlio/test_apps/parlio/main/test_parlio_rx.c b/components/esp_driver_parlio/test_apps/parlio/main/test_parlio_rx.c index 0dc56842f3..5d1ee7d130 100644 --- a/components/esp_driver_parlio/test_apps/parlio/main/test_parlio_rx.c +++ b/components/esp_driver_parlio/test_apps/parlio/main/test_parlio_rx.c @@ -97,8 +97,8 @@ static void connect_signal_internally(uint32_t gpio, uint32_t sigo, uint32_t sig .pin_bit_mask = BIT64(gpio), .mode = GPIO_MODE_INPUT_OUTPUT, .intr_type = GPIO_INTR_DISABLE, - .pull_down_en = false, - .pull_up_en = false, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE, }; gpio_config(&gpio_conf); esp_rom_gpio_connect_out_signal(gpio, sigo, false, false); diff --git a/components/esp_driver_sdmmc/src/sd_host_sdmmc.c b/components/esp_driver_sdmmc/src/sd_host_sdmmc.c index 7b7fa336ef..4a749ae0f4 100644 --- a/components/esp_driver_sdmmc/src/sd_host_sdmmc.c +++ b/components/esp_driver_sdmmc/src/sd_host_sdmmc.c @@ -1291,8 +1291,8 @@ static esp_err_t sdmmc_slot_io_config(sd_host_sdmmc_slot_t *slot, const sd_host_ gpio_config_t gpio_conf = { .pin_bit_mask = BIT64(slot_gpio->d3_io), .mode = GPIO_MODE_OUTPUT, - .pull_up_en = 0, - .pull_down_en = 0, + .pull_up_en = GPIO_PULLUP_DISABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, .intr_type = GPIO_INTR_DISABLE, }; gpio_config(&gpio_conf); diff --git a/components/esp_driver_sdspi/src/sdspi_host.c b/components/esp_driver_sdspi/src/sdspi_host.c index 147d2057e9..b490057293 100644 --- a/components/esp_driver_sdspi/src/sdspi_host.c +++ b/components/esp_driver_sdspi/src/sdspi_host.c @@ -376,7 +376,7 @@ esp_err_t sdspi_host_init_device(const sdspi_device_config_t* slot_config, sdspi .intr_type = GPIO_INTR_DISABLE, .mode = GPIO_MODE_INPUT, .pin_bit_mask = 0, - .pull_up_en = true + .pull_up_en = GPIO_PULLUP_ENABLE }; if (slot_config->gpio_cd != SDSPI_SLOT_NO_CD) { io_conf.pin_bit_mask |= (1ULL << slot_config->gpio_cd); @@ -390,8 +390,8 @@ esp_err_t sdspi_host_init_device(const sdspi_device_config_t* slot_config, sdspi slot->gpio_wp = slot_config->gpio_wp; slot->gpio_wp_polarity = slot_config->gpio_wp_polarity; if (slot->gpio_wp_polarity) { - io_conf.pull_down_en = true; - io_conf.pull_up_en = false; + io_conf.pull_down_en = GPIO_PULLDOWN_ENABLE; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; } } else { slot->gpio_wp = GPIO_UNUSED; @@ -410,7 +410,7 @@ esp_err_t sdspi_host_init_device(const sdspi_device_config_t* slot_config, sdspi io_conf = (gpio_config_t) { .intr_type = GPIO_INTR_LOW_LEVEL, .mode = GPIO_MODE_INPUT, - .pull_up_en = true, + .pull_up_en = GPIO_PULLUP_ENABLE, .pin_bit_mask = (1ULL << slot_config->gpio_int), }; ret = gpio_config(&io_conf); diff --git a/components/esp_hw_support/test_apps/wakeup_tests/main/src/io_wakeup_cmd.c b/components/esp_hw_support/test_apps/wakeup_tests/main/src/io_wakeup_cmd.c index e7e526a6da..5c13c7fea2 100644 --- a/components/esp_hw_support/test_apps/wakeup_tests/main/src/io_wakeup_cmd.c +++ b/components/esp_hw_support/test_apps/wakeup_tests/main/src/io_wakeup_cmd.c @@ -182,8 +182,8 @@ static int process_rtcio_wakeup(int argc, char **argv) gpio_config_t config = { .pin_bit_mask = BIT64(io_wakeup_num), .mode = GPIO_MODE_INPUT, - .pull_down_en = false, - .pull_up_en = false, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE, .intr_type = GPIO_INTR_DISABLE }; ESP_ERROR_CHECK(gpio_config(&config)); @@ -257,8 +257,8 @@ static int process_gpio_wakeup(int argc, char **argv) gpio_config_t config = { .pin_bit_mask = BIT64(io_wakeup_num), .mode = GPIO_MODE_INPUT, - .pull_down_en = false, - .pull_up_en = false, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE, .intr_type = (io_wakeup_level == 0) ? GPIO_INTR_LOW_LEVEL : GPIO_INTR_HIGH_LEVEL }; ESP_ERROR_CHECK(gpio_config(&config)); diff --git a/components/esp_phy/src/phy_common.c b/components/esp_phy/src/phy_common.c index b6097fdc38..a034b5d104 100644 --- a/components/esp_phy/src/phy_common.c +++ b/components/esp_phy/src/phy_common.c @@ -159,8 +159,8 @@ static void phy_ant_set_gpio_output(uint32_t io_num) io_conf.intr_type = GPIO_INTR_DISABLE; io_conf.mode = GPIO_MODE_OUTPUT; io_conf.pin_bit_mask = (1ULL << io_num); - io_conf.pull_down_en = 0; - io_conf.pull_up_en = 0; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; gpio_config(&io_conf); } diff --git a/docs/en/api-reference/peripherals/gpio.rst b/docs/en/api-reference/peripherals/gpio.rst index 38c2ee688d..904722496e 100644 --- a/docs/en/api-reference/peripherals/gpio.rst +++ b/docs/en/api-reference/peripherals/gpio.rst @@ -99,8 +99,8 @@ Do not rely on the default configurations values in the Technical Reference Manu gpio_config_t usb_phy_conf = { .pin_bit_mask = (1ULL << USB_PHY_DP_PIN) | (1ULL << USB_PHY_DM_PIN), .mode = GPIO_MODE_INPUT_OUTPUT, - .pull_up_en = 0, - .pull_down_en = 0, + .pull_up_en = GPIO_PULLUP_DISABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, .intr_type = GPIO_INTR_DISABLE, }; gpio_config(&usb_phy_conf); diff --git a/docs/zh_CN/api-reference/peripherals/gpio.rst b/docs/zh_CN/api-reference/peripherals/gpio.rst index c9732320f5..3a8ace54d2 100644 --- a/docs/zh_CN/api-reference/peripherals/gpio.rst +++ b/docs/zh_CN/api-reference/peripherals/gpio.rst @@ -99,8 +99,8 @@ GPIO 驱动提供了一个函数 :cpp:func:`gpio_dump_io_configuration` 用来 gpio_config_t usb_phy_conf = { .pin_bit_mask = (1ULL << USB_PHY_DP_PIN) | (1ULL << USB_PHY_DM_PIN), .mode = GPIO_MODE_INPUT_OUTPUT, - .pull_up_en = 0, - .pull_down_en = 0, + .pull_up_en = GPIO_PULLUP_DISABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, .intr_type = GPIO_INTR_DISABLE, }; gpio_config(&usb_phy_conf); diff --git a/examples/bluetooth/bluedroid/classic_bt/hfp_ag/main/gpio_pcm_config.c b/examples/bluetooth/bluedroid/classic_bt/hfp_ag/main/gpio_pcm_config.c index dd6507d951..ff1d789cb4 100644 --- a/examples/bluetooth/bluedroid/classic_bt/hfp_ag/main/gpio_pcm_config.c +++ b/examples/bluetooth/bluedroid/classic_bt/hfp_ag/main/gpio_pcm_config.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -30,9 +30,9 @@ void app_gpio_pcm_io_cfg(void) //bit mask of the pins that you want to set,e.g.GPIO18/19 io_conf.pin_bit_mask = GPIO_OUTPUT_PCM_PIN_SEL; //disable pull-down mode - io_conf.pull_down_en = 0; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; //disable pull-up mode - io_conf.pull_up_en = 0; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; //configure GPIO with the given settings gpio_config(&io_conf); @@ -44,8 +44,8 @@ void app_gpio_pcm_io_cfg(void) //set as input mode io_conf.mode = GPIO_MODE_INPUT; //enable pull-up mode - io_conf.pull_up_en = 0; - io_conf.pull_down_en = 0; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; //configure GPIO with the given settings gpio_config(&io_conf); @@ -73,9 +73,9 @@ void app_gpio_aec_io_cfg(void) //bit mask of the pins that you want to set,e.g.GPIO18/19 io_conf.pin_bit_mask = GPIO_OUTPUT_AEC_PIN_SEL; //disable pull-down mode - io_conf.pull_down_en = 0; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; //disable pull-up mode - io_conf.pull_up_en = 0; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; //configure GPIO with the given settings gpio_config(&io_conf); diff --git a/examples/bluetooth/bluedroid/classic_bt/hfp_hf/main/gpio_pcm_config.c b/examples/bluetooth/bluedroid/classic_bt/hfp_hf/main/gpio_pcm_config.c index dd6507d951..ff1d789cb4 100644 --- a/examples/bluetooth/bluedroid/classic_bt/hfp_hf/main/gpio_pcm_config.c +++ b/examples/bluetooth/bluedroid/classic_bt/hfp_hf/main/gpio_pcm_config.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -30,9 +30,9 @@ void app_gpio_pcm_io_cfg(void) //bit mask of the pins that you want to set,e.g.GPIO18/19 io_conf.pin_bit_mask = GPIO_OUTPUT_PCM_PIN_SEL; //disable pull-down mode - io_conf.pull_down_en = 0; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; //disable pull-up mode - io_conf.pull_up_en = 0; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; //configure GPIO with the given settings gpio_config(&io_conf); @@ -44,8 +44,8 @@ void app_gpio_pcm_io_cfg(void) //set as input mode io_conf.mode = GPIO_MODE_INPUT; //enable pull-up mode - io_conf.pull_up_en = 0; - io_conf.pull_down_en = 0; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; //configure GPIO with the given settings gpio_config(&io_conf); @@ -73,9 +73,9 @@ void app_gpio_aec_io_cfg(void) //bit mask of the pins that you want to set,e.g.GPIO18/19 io_conf.pin_bit_mask = GPIO_OUTPUT_AEC_PIN_SEL; //disable pull-down mode - io_conf.pull_down_en = 0; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; //disable pull-up mode - io_conf.pull_up_en = 0; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; //configure GPIO with the given settings gpio_config(&io_conf); diff --git a/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c index 48258887a4..d554d41413 100644 --- a/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c +++ b/examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3/main/main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -170,8 +170,8 @@ static void uart_gpio_set(void) .intr_type = GPIO_INTR_DISABLE, //disable interrupt .mode = GPIO_MODE_OUTPUT, // output mode .pin_bit_mask = GPIO_OUTPUT_PIN_SEL, // bit mask of the output pins - .pull_down_en = 0, // disable pull-down mode - .pull_up_en = 0, // disable pull-up mode + .pull_down_en = GPIO_PULLDOWN_DISABLE, // disable pull-down mode + .pull_up_en = GPIO_PULLUP_DISABLE, // disable pull-up mode }; gpio_config(&io_output_conf); @@ -179,8 +179,8 @@ static void uart_gpio_set(void) .intr_type = GPIO_INTR_DISABLE, //disable interrupt .mode = GPIO_MODE_INPUT, // input mode .pin_bit_mask = GPIO_INPUT_PIN_SEL, // bit mask of the input pins - .pull_down_en = 0, // disable pull-down mode - .pull_up_en = 0, // disable pull-down mode + .pull_down_en = GPIO_PULLDOWN_DISABLE, // disable pull-down mode + .pull_up_en = GPIO_PULLUP_DISABLE, // disable pull-down mode }; gpio_config(&io_input_conf); diff --git a/examples/bluetooth/nimble/ble_cte/common_components/cte_config/cte_config.c b/examples/bluetooth/nimble/ble_cte/common_components/cte_config/cte_config.c index c8755c87f8..63da99a130 100644 --- a/examples/bluetooth/nimble/ble_cte/common_components/cte_config/cte_config.c +++ b/examples/bluetooth/nimble/ble_cte/common_components/cte_config/cte_config.c @@ -89,8 +89,8 @@ int ble_direction_finding_antenna_init(uint8_t* gpio_array,uint8_t gpio_array_le .intr_type = GPIO_INTR_DISABLE, .mode = GPIO_MODE_OUTPUT, .pin_bit_mask = gpio_pin_maks, - .pull_down_en = false, - .pull_up_en = true, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_ENABLE, }; rc = gpio_config(&gpio_conf); if(rc != 0) { diff --git a/examples/mesh/ip_internal_network/main/mesh_main.c b/examples/mesh/ip_internal_network/main/mesh_main.c index 2165742094..7280e0000a 100644 --- a/examples/mesh/ip_internal_network/main/mesh_main.c +++ b/examples/mesh/ip_internal_network/main/mesh_main.c @@ -65,8 +65,8 @@ static void initialise_button(void) io_conf.intr_type = GPIO_INTR_DISABLE; io_conf.pin_bit_mask = BIT64(EXAMPLE_BUTTON_GPIO); io_conf.mode = GPIO_MODE_INPUT; - io_conf.pull_up_en = 1; - io_conf.pull_down_en = 0; + io_conf.pull_up_en = GPIO_PULLUP_ENABLE; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; gpio_config(&io_conf); } diff --git a/examples/network/sta2eth/main/sta2eth_main.c b/examples/network/sta2eth/main/sta2eth_main.c index 4729d34382..7d5b1b61e5 100644 --- a/examples/network/sta2eth/main/sta2eth_main.c +++ b/examples/network/sta2eth/main/sta2eth_main.c @@ -132,7 +132,7 @@ static void gpio_init(void) gpio_config_t io_conf = { .intr_type = GPIO_INTR_ANYEDGE, .pin_bit_mask = (1ULL << GPIO_INPUT), .mode = GPIO_MODE_INPUT, - .pull_up_en = 1 + .pull_up_en = GPIO_PULLUP_ENABLE }; gpio_config(&io_conf); gpio_install_isr_service(0); diff --git a/examples/peripherals/analog_comparator/main/ana_cmpr_example_main.c b/examples/peripherals/analog_comparator/main/ana_cmpr_example_main.c index 94ab57f71b..44a12946fa 100644 --- a/examples/peripherals/analog_comparator/main/ana_cmpr_example_main.c +++ b/examples/peripherals/analog_comparator/main/ana_cmpr_example_main.c @@ -14,8 +14,8 @@ void example_init_monitor_gpio(void) .intr_type = GPIO_INTR_DISABLE, .mode = GPIO_MODE_OUTPUT, .pin_bit_mask = (1ULL << EXAMPLE_MONITOR_GPIO_NUM), - .pull_down_en = false, - .pull_up_en = false, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE, }; gpio_config(&io_conf); gpio_set_level(EXAMPLE_MONITOR_GPIO_NUM, 0); diff --git a/examples/peripherals/gpio/generic_gpio/main/gpio_example_main.c b/examples/peripherals/gpio/generic_gpio/main/gpio_example_main.c index 89b7bbc88a..d095032f0e 100644 --- a/examples/peripherals/gpio/generic_gpio/main/gpio_example_main.c +++ b/examples/peripherals/gpio/generic_gpio/main/gpio_example_main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -84,9 +84,9 @@ void app_main(void) //bit mask of the pins that you want to set,e.g.GPIO18/19 io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL; //disable pull-down mode - io_conf.pull_down_en = 0; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; //disable pull-up mode - io_conf.pull_up_en = 0; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; //configure GPIO with the given settings gpio_config(&io_conf); @@ -97,7 +97,7 @@ void app_main(void) //set as input mode io_conf.mode = GPIO_MODE_INPUT; //enable pull-up mode - io_conf.pull_up_en = 1; + io_conf.pull_up_en = GPIO_PULLUP_ENABLE; gpio_config(&io_conf); //change gpio interrupt type for one pin diff --git a/examples/peripherals/sdio/host/main/app_main.c b/examples/peripherals/sdio/host/main/app_main.c index 087ad44c70..21e1a0e3d0 100644 --- a/examples/peripherals/sdio/host/main/app_main.c +++ b/examples/peripherals/sdio/host/main/app_main.c @@ -139,7 +139,7 @@ static void gpio_d2_set_high(void) gpio_config_t d2_config = { .pin_bit_mask = BIT64(PIN_D2), .mode = GPIO_MODE_OUTPUT, - .pull_up_en = true, + .pull_up_en = GPIO_PULLUP_ENABLE, }; gpio_config(&d2_config); gpio_set_level(PIN_D2, 1); @@ -313,8 +313,8 @@ void slave_power_on(void) gpio_config_t cfg = { .pin_bit_mask = BIT64(GPIO_B1), .mode = GPIO_MODE_OUTPUT, - .pull_up_en = false, - .pull_down_en = false, + .pull_up_en = GPIO_PULLUP_DISABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, .intr_type = GPIO_INTR_DISABLE, }; gpio_config(&cfg); diff --git a/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c b/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c index 498a83e1a1..608ba185ae 100644 --- a/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c +++ b/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c @@ -244,7 +244,7 @@ void lcd_init(spi_device_handle_t spi) gpio_config_t io_conf = {}; io_conf.pin_bit_mask = ((1ULL << PIN_NUM_DC) | (1ULL << PIN_NUM_RST) | (1ULL << PIN_NUM_BCKL)); io_conf.mode = GPIO_MODE_OUTPUT; - io_conf.pull_up_en = true; + io_conf.pull_up_en = GPIO_PULLUP_ENABLE; gpio_config(&io_conf); //Reset the display diff --git a/examples/peripherals/spi_slave/sender/main/app_main.c b/examples/peripherals/spi_slave/sender/main/app_main.c index 8fcec745a2..18dfd235a4 100644 --- a/examples/peripherals/spi_slave/sender/main/app_main.c +++ b/examples/peripherals/spi_slave/sender/main/app_main.c @@ -100,7 +100,7 @@ void app_main(void) gpio_config_t io_conf = { .intr_type = GPIO_INTR_POSEDGE, .mode = GPIO_MODE_INPUT, - .pull_up_en = 1, + .pull_up_en = GPIO_PULLUP_ENABLE, .pin_bit_mask = BIT64(GPIO_HANDSHAKE), }; diff --git a/examples/peripherals/timer_group/gptimer_capture_hc_sr04/main/gptimer_capture_hc_sr04.c b/examples/peripherals/timer_group/gptimer_capture_hc_sr04/main/gptimer_capture_hc_sr04.c index 978f7ceefc..54f2e51c3c 100644 --- a/examples/peripherals/timer_group/gptimer_capture_hc_sr04/main/gptimer_capture_hc_sr04.c +++ b/examples/peripherals/timer_group/gptimer_capture_hc_sr04/main/gptimer_capture_hc_sr04.c @@ -80,7 +80,7 @@ void app_main(void) gpio_config_t echo_io_conf = { .mode = GPIO_MODE_INPUT, .intr_type = GPIO_INTR_ANYEDGE, // capture signal on both edge - .pull_up_en = true, // pull up internally + .pull_up_en = GPIO_PULLUP_ENABLE, // pull up internally .pin_bit_mask = 1ULL << HC_SR04_ECHO_GPIO, }; ESP_ERROR_CHECK(gpio_config(&echo_io_conf)); diff --git a/examples/peripherals/usb/device/tusb_hid/main/tusb_hid_example_main.c b/examples/peripherals/usb/device/tusb_hid/main/tusb_hid_example_main.c index 6ac2971614..38d9529c69 100644 --- a/examples/peripherals/usb/device/tusb_hid/main/tusb_hid_example_main.c +++ b/examples/peripherals/usb/device/tusb_hid/main/tusb_hid_example_main.c @@ -158,8 +158,8 @@ void app_main(void) .pin_bit_mask = BIT64(APP_BUTTON), .mode = GPIO_MODE_INPUT, .intr_type = GPIO_INTR_DISABLE, - .pull_up_en = true, - .pull_down_en = false, + .pull_up_en = GPIO_PULLUP_ENABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, }; ESP_ERROR_CHECK(gpio_config(&boot_button_config)); diff --git a/examples/phy/cert_test/main/cmd_phy.c b/examples/phy/cert_test/main/cmd_phy.c index 92a05ea168..343d7e461f 100644 --- a/examples/phy/cert_test/main/cmd_phy.c +++ b/examples/phy/cert_test/main/cmd_phy.c @@ -474,9 +474,9 @@ void esp_phy_gpio_output_set(int number, int level) { //bit mask of the pin that you want to set,e.g.GPIO18/19 io_conf.pin_bit_mask = (1ULL<pins[i]); - io_conf.pull_down_en = 0; - io_conf.pull_up_en = 0; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; gpio_config(&io_conf); } diff --git a/examples/system/light_sleep/main/gpio_wakeup.c b/examples/system/light_sleep/main/gpio_wakeup.c index 0340248230..7627a39926 100644 --- a/examples/system/light_sleep/main/gpio_wakeup.c +++ b/examples/system/light_sleep/main/gpio_wakeup.c @@ -44,8 +44,8 @@ esp_err_t example_register_gpio_wakeup(void) gpio_config_t config = { .pin_bit_mask = BIT64(GPIO_WAKEUP_NUM), .mode = GPIO_MODE_INPUT, - .pull_down_en = false, - .pull_up_en = false, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .pull_up_en = GPIO_PULLUP_DISABLE, .intr_type = GPIO_INTR_DISABLE }; ESP_RETURN_ON_ERROR(gpio_config(&config), TAG, "Initialize GPIO%d failed", GPIO_WAKEUP_NUM); diff --git a/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.c b/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.c index 8c03708cc8..198459efa8 100644 --- a/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.c +++ b/examples/zigbee/light_sample/HA_on_off_switch/main/switch_driver.c @@ -149,7 +149,7 @@ static bool switch_driver_gpio_init(switch_func_pair_t *button_func_pair, uint8_ io_conf.intr_type = GPIO_INTR_NEGEDGE; io_conf.pin_bit_mask = pin_bit_mask; io_conf.mode = GPIO_MODE_INPUT; - io_conf.pull_up_en = 1; + io_conf.pull_up_en = GPIO_PULLUP_ENABLE; /* configure GPIO with the given settings */ gpio_config(&io_conf); /* create a queue to handle gpio event from isr */