1.40.20.24 SERCOMx_USART_LIN_CommandSet Function

C

/* x = SERCOM instance number */

/* Blocking, non-blocking and ring buffer mode */

bool SERCOMx_USART_LIN_CommandSet(USART_LIN_MASTER_CMD cmd)

Summary

This API lets the application to select between automatic transmission of the complete LIN header or software controlled transmission of LIN header in LIN master mode.

Description

This API lets the application to select between automatic transmission of the complete LIN header or software controlled transmission where various header components are controlled by software. The LIN header consists of break character followed by a Sync byte followed by a PID byte. This API is only available when LIN Master mode is selected in MHC.

Precondition

SERCOMx_USART_Initialize must have been called for the associated SERCOM_USART instance.

Parameters

Param Description
USART_LIN_MASTER_CMD_SOFTWARE_CONTROLLED LIN header frame is controlled by software
USART_LIN_MASTER_CMD_AUTO_TRANSMIT LIN header frame is transmitted automatically byhardware

Returns

true - operation is successful

false - operation is unsuccessful. LIN command strobe must not be issued when the transmitter is busy.

Example

if (SERCOM0_USART_LIN_CommandSet(USART_LIN_MASTER_CMD_AUTO_TRANSMIT) == true)
{
    txBuffer[0] = 0x80;		// PID value
    
    // Transmit the LIN frame (Break + Sync + PID)
    SERCOM0_USART_Write(txBuffer, 1);
}

Remarks

This API is only available on the devices that has LIN support.