[][src]Function esp_idf_sys::spi_bus_add_device

pub unsafe extern "C" fn spi_bus_add_device(
    host: spi_host_device_t,
    dev_config: *const spi_device_interface_config_t,
    handle: *mut spi_device_handle_t
) -> esp_err_t

@brief Allocate a device on a SPI bus

This initializes the internal structures for a device, plus allocates a CS pin on the indicated SPI master peripheral and routes it to the indicated GPIO. All SPI master devices have three CS pins and can thus control up to three devices.

@note While in general, speeds up to 80MHz on the dedicated SPI pins and 40MHz on GPIO-matrix-routed pins are supported, full-duplex transfers routed over the GPIO matrix only support speeds up to 26MHz.

@param host SPI peripheral to allocate device on @param dev_config SPI interface protocol config for the device @param handle Pointer to variable to hold the device handle @return - ESP_ERR_INVALID_ARG if parameter is invalid - ESP_ERR_NOT_FOUND if host doesn't have any free CS slots - ESP_ERR_NO_MEM if out of memory - ESP_OK on success