16.6.4.10 Function usart_init()
Initializes the device.
enum status_code usart_init( struct usart_module *const module, Sercom *const hw, const struct usart_config *const config)
Initializes the USART device based on the setting specified in the configuration struct.
Data direction | Parameter name | Description |
---|---|---|
[out] |
module |
Pointer to USART device |
[in] |
hw |
Pointer to USART hardware instance |
[in] |
config |
Pointer to configuration struct |
Returns
Status of the initialization.
Return value | Description |
---|---|
STATUS_OK |
The initialization was successful |
STATUS_BUSY |
The USART module is busy resetting |
STATUS_ERR_DENIED |
The USART has not been disabled in advance of initialization |
STATUS_ERR_INVALID_ARG |
The configuration struct contains invalid configuration |
STATUS_ERR_ALREADY_INITIALIZED |
The SERCOM instance has already been initialized with different clock configuration |
STATUS_ERR_BAUD_UNAVAILABLE |
The BAUD rate given by the configuration struct cannot be reached with the current clock configuration |