Skip to content

Commit 3e2945b

Browse files
committed
fix(gpio): remove GPIO_OUTPUT_SET macro for ESP32P4
Use GPIO_OUTPUT_SET led to compilation error Closes #16050
1 parent 60bef64 commit 3e2945b

File tree

17 files changed

+104
-367
lines changed

17 files changed

+104
-367
lines changed

components/esp_driver_gpio/test_apps/gpio/sdkconfig.ci.iram_safe

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
88
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
99
# GPIO test uses IPC call, the default stack size of IPC task can satisfy the -O0 optimization
1010
CONFIG_ESP_IPC_TASK_STACK_SIZE=2048
11+
# test gpio functionality with non-default option
12+
CONFIG_HAL_GPIO_USE_ROM_IMPL=n

components/esp_rom/esp32/include/esp32/rom/gpio.h

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -36,15 +36,6 @@ extern "C" {
3636

3737
#define GPIO_REGID_TO_PINIDX(reg_id) ((reg_id) - GPIO_ID_PIN0)
3838

39-
typedef enum {
40-
GPIO_PIN_INTR_DISABLE = 0,
41-
GPIO_PIN_INTR_POSEDGE = 1,
42-
GPIO_PIN_INTR_NEGEDGE = 2,
43-
GPIO_PIN_INTR_ANYEDGE = 3,
44-
GPIO_PIN_INTR_LOLEVEL = 4,
45-
GPIO_PIN_INTR_HILEVEL = 5
46-
} GPIO_INT_TYPE;
47-
4839
#define GPIO_OUTPUT_SET(gpio_no, bit_value) \
4940
((gpio_no < 32) ? gpio_output_set(bit_value<<gpio_no, (bit_value ? 0 : 1)<<gpio_no, 1<<gpio_no,0) : \
5041
gpio_output_set_high(bit_value<<(gpio_no - 32), (bit_value ? 0 : 1)<<(gpio_no - 32), 1<<(gpio_no -32),0))
@@ -103,28 +94,6 @@ uint32_t gpio_input_get(void);
10394
*/
10495
uint32_t gpio_input_get_high(void);
10596

106-
/**
107-
* @brief Set GPIO to wakeup the ESP32.
108-
* Please do not call this function in SDK.
109-
*
110-
* @param uint32_t i: gpio number.
111-
*
112-
* @param GPIO_INT_TYPE intr_state : only GPIO_PIN_INTR_LOLEVEL\GPIO_PIN_INTR_HILEVEL can be used
113-
*
114-
* @return None
115-
*/
116-
void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state);
117-
118-
/**
119-
* @brief disable GPIOs to wakeup the ESP32.
120-
* Please do not call this function in SDK.
121-
*
122-
* @param None
123-
*
124-
* @return None
125-
*/
126-
void gpio_pin_wakeup_disable(void);
127-
12897
/**
12998
* @brief set gpio input to a signal, one gpio can input to several signals.
13099
*

components/esp_rom/esp32c2/include/esp32c2/rom/gpio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mas
7373
uint32_t gpio_input_get(void);
7474

7575
/**
76-
* @brief Set GPIO to wakeup the ESP32.
76+
* @brief Set GPIO to wakeup the chip.
7777
* Please do not call this function in SDK.
7878
*
7979
* @param uint32_t i: gpio number.
@@ -85,7 +85,7 @@ uint32_t gpio_input_get(void);
8585
void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state);
8686

8787
/**
88-
* @brief disable GPIOs to wakeup the ESP32.
88+
* @brief disable GPIOs to wakeup the chip.
8989
* Please do not call this function in SDK.
9090
*
9191
* @param None

components/esp_rom/esp32c3/include/esp32c3/rom/gpio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mas
7373
uint32_t gpio_input_get(void);
7474

7575
/**
76-
* @brief Set GPIO to wakeup the ESP32.
76+
* @brief Set GPIO to wakeup the chip.
7777
* Please do not call this function in SDK.
7878
*
7979
* @param uint32_t i: gpio number.
@@ -85,7 +85,7 @@ uint32_t gpio_input_get(void);
8585
void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state);
8686

8787
/**
88-
* @brief disable GPIOs to wakeup the ESP32.
88+
* @brief disable GPIOs to wakeup the chip.
8989
* Please do not call this function in SDK.
9090
*
9191
* @param None

components/esp_rom/esp32c5/include/esp32c5/rom/gpio.h

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -33,62 +33,23 @@ extern "C" {
3333

3434
#define GPIO_REGID_TO_PINIDX(reg_id) ((reg_id) - GPIO_ID_PIN0)
3535

36-
typedef enum {
37-
GPIO_PIN_INTR_DISABLE = 0,
38-
GPIO_PIN_INTR_POSEDGE = 1,
39-
GPIO_PIN_INTR_NEGEDGE = 2,
40-
GPIO_PIN_INTR_ANYEDGE = 3,
41-
GPIO_PIN_INTR_LOLEVEL = 4,
42-
GPIO_PIN_INTR_HILEVEL = 5
43-
} GPIO_INT_TYPE;
44-
45-
46-
/**
47-
* @brief Change GPIO(0-28) pin output by setting, clearing, or disabling pins, GPIO0<->BIT(0).
48-
* There is no particular ordering guaranteed; so if the order of writes is significant,
49-
* calling code should divide a single call into multiple calls.
50-
*
51-
* @param uint32_t set_mask : the gpios that need high level.
52-
*
53-
* @param uint32_t clear_mask : the gpios that need low level.
54-
*
55-
* @param uint32_t enable_mask : the gpios that need be changed.
56-
*
57-
* @param uint32_t disable_mask : the gpios that need disable output.
58-
*
59-
* @return None
60-
*/
61-
void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mask, uint32_t disable_mask);
6236

6337
/**
64-
* @brief Sample the value of GPIO input pins(0-28) and returns a bitmask.
65-
* @param None
38+
* @brief Set GPIO output level
6639
*
67-
* @return uint32_t : bitmask for GPIO input pins, BIT(0) for GPIO0.
40+
* @param gpio_num GPIO number
41+
* @param level Output level, 0:low; 1:high
6842
*/
69-
uint32_t gpio_input_get(void);
43+
void gpio_set_output_level(uint32_t gpio_num, uint32_t level);
7044

7145
/**
72-
* @brief Set GPIO to wakeup.
73-
* Please do not call this function in SDK.
74-
*
75-
* @param uint32_t i: gpio number.
46+
* @brief Get GPIO input level
7647
*
77-
* @param GPIO_INT_TYPE intr_state : only GPIO_PIN_INTR_LOLEVEL\GPIO_PIN_INTR_HILEVEL can be used
48+
* @param gpio_num GPIO number
7849
*
79-
* @return None
80-
*/
81-
void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state);
82-
83-
/**
84-
* @brief disable GPIOs to wakeup.
85-
* Please do not call this function in SDK.
86-
*
87-
* @param None
88-
*
89-
* @return None
50+
* @return 0:the GPIO_input level is low; 1:the GPIO input level is high
9051
*/
91-
void gpio_pin_wakeup_disable(void);
52+
uint32_t gpio_get_input_level(uint32_t gpio_num);
9253

9354
/**
9455
* @brief set gpio input to a signal, one gpio can input to several signals.

components/esp_rom/esp32c6/include/esp32c6/rom/gpio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mas
7272
uint32_t gpio_input_get(void);
7373

7474
/**
75-
* @brief Set GPIO to wakeup the ESP32.
75+
* @brief Set GPIO to wakeup the chip.
7676
* Please do not call this function in SDK.
7777
*
7878
* @param uint32_t i: gpio number.
@@ -84,7 +84,7 @@ uint32_t gpio_input_get(void);
8484
void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state);
8585

8686
/**
87-
* @brief disable GPIOs to wakeup the ESP32.
87+
* @brief disable GPIOs to wakeup the chip.
8888
* Please do not call this function in SDK.
8989
*
9090
* @param None

components/esp_rom/esp32c61/include/esp32c61/rom/gpio.h

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -33,62 +33,23 @@ extern "C" {
3333

3434
#define GPIO_REGID_TO_PINIDX(reg_id) ((reg_id) - GPIO_ID_PIN0)
3535

36-
typedef enum {
37-
GPIO_PIN_INTR_DISABLE = 0,
38-
GPIO_PIN_INTR_POSEDGE = 1,
39-
GPIO_PIN_INTR_NEGEDGE = 2,
40-
GPIO_PIN_INTR_ANYEDGE = 3,
41-
GPIO_PIN_INTR_LOLEVEL = 4,
42-
GPIO_PIN_INTR_HILEVEL = 5
43-
} GPIO_INT_TYPE;
44-
45-
46-
/**
47-
* @brief Change GPIO(0-29) pin output by setting, clearing, or disabling pins, GPIO0<->BIT(0).
48-
* There is no particular ordering guaranteed; so if the order of writes is significant,
49-
* calling code should divide a single call into multiple calls.
50-
*
51-
* @param uint32_t set_mask : the gpios that need high level.
52-
*
53-
* @param uint32_t clear_mask : the gpios that need low level.
54-
*
55-
* @param uint32_t enable_mask : the gpios that need be changed.
56-
*
57-
* @param uint32_t disable_mask : the gpios that need disable output.
58-
*
59-
* @return None
60-
*/
61-
void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mask, uint32_t disable_mask);
6236

6337
/**
64-
* @brief Sample the value of GPIO input pins(0-29) and returns a bitmask.
65-
* @param None
38+
* @brief Set GPIO output level
6639
*
67-
* @return uint32_t : bitmask for GPIO input pins, BIT(0) for GPIO0.
40+
* @param gpio_num GPIO number
41+
* @param level Output level, 0:low; 1:high
6842
*/
69-
uint32_t gpio_input_get(void);
43+
void gpio_set_output_level(uint32_t gpio_num, uint32_t level);
7044

7145
/**
72-
* @brief Set GPIO to wakeup.
73-
* Please do not call this function in SDK.
74-
*
75-
* @param uint32_t i: gpio number.
46+
* @brief Get GPIO input level
7647
*
77-
* @param GPIO_INT_TYPE intr_state : only GPIO_PIN_INTR_LOLEVEL\GPIO_PIN_INTR_HILEVEL can be used
48+
* @param gpio_num GPIO number
7849
*
79-
* @return None
80-
*/
81-
void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state);
82-
83-
/**
84-
* @brief disable GPIOs to wakeup.
85-
* Please do not call this function in SDK.
86-
*
87-
* @param None
88-
*
89-
* @return None
50+
* @return 0:the GPIO_input level is low; 1:the GPIO input level is high
9051
*/
91-
void gpio_pin_wakeup_disable(void);
52+
uint32_t gpio_get_input_level(uint32_t gpio_num);
9253

9354
/**
9455
* @brief set gpio input to a signal, one gpio can input to several signals.

components/esp_rom/esp32h2/include/esp32h2/rom/gpio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mas
7373
uint32_t gpio_input_get(void);
7474

7575
/**
76-
* @brief Set GPIO to wakeup the ESP32.
76+
* @brief Set GPIO to wakeup the chip.
7777
* Please do not call this function in SDK.
7878
*
7979
* @param uint32_t i: gpio number.
@@ -85,7 +85,7 @@ uint32_t gpio_input_get(void);
8585
void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state);
8686

8787
/**
88-
* @brief disable GPIOs to wakeup the ESP32.
88+
* @brief disable GPIOs to wakeup the chip.
8989
* Please do not call this function in SDK.
9090
*
9191
* @param None

components/esp_rom/esp32h21/include/esp32h21/rom/gpio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mas
7373
uint32_t gpio_input_get(void);
7474

7575
/**
76-
* @brief Set GPIO to wakeup the ESP32H21.
76+
* @brief Set GPIO to wakeup the chip.
7777
* Please do not call this function in SDK.
7878
*
7979
* @param uint32_t i: gpio number.
@@ -85,7 +85,7 @@ uint32_t gpio_input_get(void);
8585
void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state);
8686

8787
/**
88-
* @brief disable GPIOs to wakeup the ESP32H21.
88+
* @brief disable GPIOs to wakeup the chip.
8989
* Please do not call this function in SDK.
9090
*
9191
* @param None

0 commit comments

Comments
 (0)