19.6.4.5.7 Function spi_select_slave()

Selects slave device.

enum status_code spi_select_slave( struct spi_module *const module, struct spi_slave_inst *const slave, bool select)

This function will drive the slave select pin of the selected device low or high depending on the select Boolean. If slave address recognition is enabled, the address will be sent to the slave when selecting it.

Table 19-39. Parameters
Data directionParameter nameDescription

[in]

module

Pointer to the software module struct

[in]

slave

Pointer to the attached slave

[in]

select

Boolean stating if the slave should be selected or deselected

Returns

Status of the operation.

Table 19-40. Return Values
Return valueDescription

STATUS_OK

If the slave device was selected

STATUS_ERR_UNSUPPORTED_DEV

If the SPI module is operating in slave mode

STATUS_BUSY

If the SPI module is not ready to write the slave address