[][src]Function esp_idf_sys::spi_bus_initialize

pub unsafe extern "C" fn spi_bus_initialize(
    host: spi_host_device_t,
    bus_config: *const spi_bus_config_t,
    dma_chan: c_int
) -> esp_err_t

@brief Initialize a SPI bus

@warning For now, only supports HSPI and VSPI.

@param host 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 Either channel 1 or 2, or 0 in the case when no DMA is required. Selecting a DMA channel for a SPI bus allows transfers on the bus to have sizes only limited by the amount of internal memory. Selecting no DMA channel (by passing the value 0) limits the amount of bytes transfered to a maximum of 32.

@warning If a DMA channel is selected, any transmit and receive buffer used should be allocated in DMA-capable memory.

@return - ESP_ERR_INVALID_ARG if configuration is invalid - ESP_ERR_INVALID_STATE if host already is in use - ESP_ERR_NO_MEM if out of memory - ESP_OK on success