19.6.4.1.4 Function spi_init()

Initializes the SERCOM SPI module.

enum status_code spi_init( struct spi_module *const module, Sercom *const hw, const struct spi_config *const config)

This function will initialize the SERCOM SPI module, based on the values of the config struct.

Table 19-12. Parameters
Data directionParameter nameDescription

[out]

module

Pointer to the software instance struct

[in]

hw

Pointer to hardware instance

[in]

config

Pointer to the config struct

Returns

Status of the initialization.

Table 19-13. Return Values
Return valueDescription

STATUS_OK

Module initiated correctly

STATUS_ERR_DENIED

If module is enabled

STATUS_BUSY

If module is busy resetting

STATUS_ERR_INVALID_ARG

If invalid argument(s) were provided