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 1. Parameters
Data direction Parameter name Description

[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 2. Return Values
Return value Description

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