From 86fd4b983f71f7855ca1e4676d87ffb9eace476e Mon Sep 17 00:00:00 2001 From: wanlei Date: Fri, 3 Mar 2023 17:28:54 +0800 Subject: [PATCH] spi_slave: fix io re-config issue --- components/driver/spi_slave.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/driver/spi_slave.c b/components/driver/spi_slave.c index fc23ec7b7a..5029f8891e 100644 --- a/components/driver/spi_slave.c +++ b/components/driver/spi_slave.c @@ -51,6 +51,7 @@ static const char *SPI_TAG = "spi_slave"; typedef struct { int id; + spi_bus_config_t bus_config; spi_slave_interface_config_t cfg; intr_handle_t intr; spi_slave_hal_context_t hal; @@ -136,6 +137,7 @@ esp_err_t spi_slave_initialize(spi_host_device_t host, const spi_bus_config_t *b } memset(spihost[host], 0, sizeof(spi_slave_t)); memcpy(&spihost[host]->cfg, slave_config, sizeof(spi_slave_interface_config_t)); + memcpy(&spihost[host]->bus_config, bus_config, sizeof(spi_bus_config_t)); spihost[host]->id = host; bool use_dma = (dma_chan != SPI_DMA_DISABLED); @@ -262,6 +264,7 @@ esp_err_t spi_slave_free(spi_host_device_t host) if (spihost[host]->dma_enabled) { spicommon_dma_chan_free(host); } + spicommon_bus_free_io_cfg(&spihost[host]->bus_config); free(spihost[host]->hal.dmadesc_tx); free(spihost[host]->hal.dmadesc_rx); esp_intr_free(spihost[host]->intr);