Skip to content

Commit 1770f42

Browse files
committed
Merge branch 'bugfix/revise_spi_dma_channel' into 'master'
bus: revise spi dma channel for idf v4.3 See merge request rd/esp-iot-solution!529
2 parents 6b0b1c4 + e412568 commit 1770f42

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

components/bus/spi_bus.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ spi_bus_handle_t spi_bus_create(spi_host_device_t host_id, const spi_config_t *b
6969
.quadhd_io_num = -1,
7070
.max_transfer_sz = bus_conf->max_transfer_sz,
7171
};
72+
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0))
73+
esp_err_t ret = spi_bus_initialize(host_id, &buscfg, SPI_DMA_CH_AUTO);
74+
#else
7275
int dma_chan = host_id; //set dma channel equals to host_id by default
7376
esp_err_t ret = spi_bus_initialize(host_id, &buscfg, dma_chan);
77+
#endif
7478
SPI_BUS_CHECK(ESP_OK == ret, "spi bus create failed", NULL);
7579
s_spi_bus[index].host_id = host_id;
7680
memcpy(&s_spi_bus[index].conf, &buscfg, sizeof(spi_bus_config_t));
@@ -199,7 +203,7 @@ esp_err_t spi_bus_transfer_bytes(spi_bus_device_handle_t dev_handle, const uint8
199203
return ESP_OK;
200204
}
201205

202-
/**************************************** Public Functions (Low level)*********************************************/
206+
/**************************************** Public Functions (Low level)*********************************************/
203207

204208
esp_err_t spi_bus_transmit_begin(spi_bus_device_handle_t dev_handle, spi_transaction_t *p_trans)
205209
{

0 commit comments

Comments
 (0)