-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bugfix/esp_rom_gpio_connect_out_signal_patch' into 'mas…
…ter' fix(gpio): patched esp_rom_gpio_connect_out_signal for esp32 and esp32s2 Closes IDFGH-11731 and IDFGH-13373 See merge request espressif/esp-idf!32816
- Loading branch information
Showing
4 changed files
with
40 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "sdkconfig.h" | ||
#include "esp_attr.h" | ||
#include "esp_rom_gpio.h" | ||
#include "soc/gpio_reg.h" | ||
|
||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 | ||
// On such targets, the ROM code for this function enabled output for the pad first, and then connected the signal | ||
// This could result in an undesired glitch at the pad | ||
IRAM_ATTR void esp_rom_gpio_connect_out_signal(uint32_t gpio_num, uint32_t signal_idx, bool out_inv, bool oen_inv) | ||
{ | ||
uint32_t value = signal_idx << GPIO_FUNC0_OUT_SEL_S; | ||
if (out_inv) { | ||
value |= GPIO_FUNC0_OUT_INV_SEL_M; | ||
} | ||
if (oen_inv) { | ||
value |= GPIO_FUNC0_OEN_INV_SEL_M; | ||
} | ||
REG_WRITE(GPIO_FUNC0_OUT_SEL_CFG_REG + (gpio_num * 4), value); | ||
|
||
REG_WRITE(GPIO_ENABLE_W1TS_REG, (1 << gpio_num)); | ||
} | ||
#endif |