mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(i2s): fix the auto port failure when use simplex on ESP32
This commit is contained in:
committed by
Kevin (Lao Kaiyao)
parent
e7ce110dc4
commit
edb0462931
@@ -251,13 +251,34 @@ static esp_err_t s_i2s_channel_try_to_constitude_std_duplex(i2s_chan_handle_t ha
|
||||
if (memcmp(another_handle->mode_info, &curr_cfg, sizeof(i2s_std_config_t)) == 0) {
|
||||
handle->controller->full_duplex = true;
|
||||
ESP_LOGD(TAG, "Constitude full-duplex on port %d", handle->controller->id);
|
||||
}
|
||||
} else {
|
||||
#if SOC_I2S_HW_VERSION_1
|
||||
else {
|
||||
ESP_LOGE(TAG, "Can't set different channel configurations on a same port");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
bool port_changed = false;
|
||||
if (handle->is_port_auto) {
|
||||
ESP_LOGD(TAG, "TX & RX on I2S%d are simplex", handle->controller->id);
|
||||
for (int i = 0; i < I2S_LL_GET(INST_NUM); i++) {
|
||||
if (i == handle->controller->id) {
|
||||
continue;
|
||||
}
|
||||
ESP_LOGD(TAG, "Trying to move %s channel from port %d to %d",
|
||||
handle->dir == I2S_DIR_TX ? "TX" : "RX", handle->controller->id, i);
|
||||
if (i2s_channel_change_port(handle, i) == ESP_OK) {
|
||||
ESP_LOGD(TAG, "Move success!");
|
||||
port_changed = true;
|
||||
break;
|
||||
} else {
|
||||
ESP_LOGD(TAG, "Move failed...");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!port_changed) {
|
||||
ESP_LOGE(TAG, "Can't set different channel configurations on a same port");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
#else
|
||||
ESP_LOGD(TAG, "TX & RX on I2S%d are simplex", handle->controller->id);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/* Switch to the slave role if needed */
|
||||
if (handle->controller->full_duplex &&
|
||||
|
||||
Reference in New Issue
Block a user