Skip to content

Commit 79fd265

Browse files
committed
feat(i2s): append the i2s signals instead of overwrite
1 parent 3dd1ad9 commit 79fd265

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

components/esp_driver_i2s/i2s_common.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -892,12 +892,12 @@ void i2s_gpio_check_and_set(i2s_chan_handle_t handle, int gpio, uint32_t signal_
892892
if (gpio != (int)I2S_GPIO_UNUSED) {
893893
gpio_func_sel(gpio, PIN_FUNC_GPIO);
894894
if (is_input) {
895-
/* Set direction, for some GPIOs, the input function are not enabled as default */
896-
gpio_set_direction(gpio, GPIO_MODE_INPUT);
895+
/* Enable the input, for some GPIOs, the input function are not enabled as default */
896+
gpio_input_enable(gpio);
897897
esp_rom_gpio_connect_in_signal(gpio, signal_idx, is_invert);
898898
} else {
899899
i2s_output_gpio_reserve(handle, gpio);
900-
gpio_set_direction(gpio, GPIO_MODE_OUTPUT);
900+
/* output will be enabled in esp_rom_gpio_connect_out_signal */
901901
esp_rom_gpio_connect_out_signal(gpio, signal_idx, is_invert, 0);
902902
}
903903
}
@@ -908,7 +908,7 @@ void i2s_gpio_loopback_set(i2s_chan_handle_t handle, int gpio, uint32_t out_sig_
908908
if (gpio != (int)I2S_GPIO_UNUSED) {
909909
i2s_output_gpio_reserve(handle, gpio);
910910
gpio_func_sel(gpio, PIN_FUNC_GPIO);
911-
gpio_set_direction(gpio, GPIO_MODE_INPUT_OUTPUT);
911+
gpio_input_enable(gpio);
912912
esp_rom_gpio_connect_out_signal(gpio, out_sig_idx, 0, 0);
913913
esp_rom_gpio_connect_in_signal(gpio, in_sig_idx, 0);
914914
}

components/esp_hw_support/esp_clock_output.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ static esp_clock_output_mapping_t* clkout_mapping_alloc(clkout_channel_handle_t*
143143
#elif SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX
144144
gpio_set_pull_mode(gpio_num, GPIO_FLOATING);
145145
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO);
146-
gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT);
147146
esp_rom_gpio_connect_out_signal(gpio_num, CLKOUT_CHANNEL_TO_GPIO_SIG_ID(allocated_mapping->clkout_channel_hdl->channel_id), false, false);
148147
#endif
149148
}
@@ -175,7 +174,7 @@ static void clkout_mapping_free(esp_clock_output_mapping_t *mapping_hdl)
175174
if (--mapping_hdl->ref_cnt == 0) {
176175
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[mapping_hdl->mapped_io], PIN_FUNC_GPIO);
177176
esp_rom_gpio_connect_out_signal(mapping_hdl->mapped_io, SIG_GPIO_OUT_IDX, false, false);
178-
gpio_set_direction(mapping_hdl->mapped_io, GPIO_MODE_DISABLE);
177+
gpio_output_disable(mapping_hdl->mapped_io);
179178

180179
portENTER_CRITICAL(&mapping_hdl->clkout_channel_hdl->clkout_channel_lock);
181180
mapping_hdl->clkout_channel_hdl->mapped_io_bmap &= ~BIT(mapping_hdl->mapped_io);

0 commit comments

Comments
 (0)