Function esp_idf_sys::spi_bus_initialize
source ยท pub unsafe extern "C" fn spi_bus_initialize(
host_id: spi_host_device_t,
bus_config: *const spi_bus_config_t,
dma_chan: spi_dma_chan_t,
) -> esp_err_t
Expand description
@brief Initialize a SPI bus
@warning SPI0/1 is not supported
@param host_id SPI peripheral that controls this bus @param bus_config Pointer to a spi_bus_config_t struct specifying how the host should be initialized @param 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.
@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.
@return - 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