spi_bus_initialize() function
Initialize a SPI bus @warning SPI0/1 is not supported @warning If a DMA channel is selected, any transmit and receive buffer used should be allocated in DMA-capable memory. @warning The ISR of SPI is always executed on the core which calls this function. Never starve the ISR on this core or the SPI transactions will not be handled.
Arguments
host_id
SPI peripheral that controls this bus
bus_config
Pointer to a spi_bus_config_t struct specifying how the host should be initialized
dma_chan
- Selecting a DMA channel for an SPI bus allows transactions on the bus with size only limited by the amount of internal memory. - Selecting SPI_DMA_DISABLED limits the size of transactions. - Set to SPI_DMA_DISABLED if only the SPI flash uses this bus. - Set to SPI_DMA_CH_AUTO to let the driver to allocate the DMA channel.
Return value
- ESP_ERR_INVALID_ARG if configuration is invalid - ESP_ERR_INVALID_STATE if host already is in use - ESP_ERR_NOT_FOUND if there is no available DMA channel - ESP_ERR_NO_MEM if out of memory - ESP_OK on success
spi_bus_initialize() is called by 1 function and calls 15 functions:
![]()
spi_bus_initialize()
spi_bus_initialize() reads 20 variables and writes 6 variables:
![]()
spi_bus_initialize()
spi_bus_initialize() allocates 2 typess and frees 1 types:
![]()
spi_bus_initialize()