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++.
This commit is contained in:
Darian Leung
2025-08-05 16:30:45 +08:00
committed by Song Ruo Jing
parent dd73346503
commit 5454499877
29 changed files with 81 additions and 81 deletions

View File

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