Function esp_idf_svc::hal::sys::spi_slave_initialize

source ยท
pub unsafe extern "C" fn spi_slave_initialize(
    host: u32,
    bus_config: *const spi_bus_config_t,
    slave_config: *const spi_slave_interface_config_t,
    dma_chan: u32,
) -> i32
Expand description

@brief Initialize a SPI bus as a slave interface

@warning SPI0/1 is not supported

@param host SPI peripheral to use as a SPI slave interface @param bus_config Pointer to a spi_bus_config_t struct specifying how the host should be initialized @param slave_config Pointer to a spi_slave_interface_config_t struct specifying the details for the slave interface @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