1.2.21.24 1.3.25.24 1.4.21.24 1.5.25.24 1.6.22.24 1.7.23.24 1.9.19.24 1.29.23.24 1.30.18.24 1.31.18.24 1.32.26.24 1.33.16.24 1.37.18.24 1.38.21.24 1.39.18.24 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.