Jump to main content

##

# 2.131.37 USARTx_LIN_IdentifierRead Function

## C

    /* x = USART instance number */

    /* Blocking and Ring buffer mode */

    uint8_t USARTx_LIN_IdentifierRead( void)

## Summary

This API allows the application to read LIN ID received during reception of LIN Header

## Description

This API allows the application to read LIN ID received during reception of LIN Header

## Precondition

USARTx_Initialize must have been called for the associated USART instance.

## Parameters

None

## Returns

API returns identifier read from LIN Id register

## Example

    /* LIN IDs */
    #define READ_SWITCH_LED_PID             0x80
    #define WRITE_LED_PID                   0xC1
    uint8_t rxBuffer[10];

    void LIN_Id_Rcvd_Callback_Handler( uintptr_t context)
    {
        /* Read out the PID */
        rxBuffer[0] = USART0_LIN_IdentifierRead();
        switch(rxBuffer[0])
        {
            case READ_SWITCH_LED_PID:
                /* Client should be in PUBLISH mode now, as client has to send SWITCH status requested by Master */
                break;

            case WRITE_LED_PID:
                /* Client should be in SUBSCRIBE mode now, as Master is about to send data for LED ON/OFF */
                break;
        }

    }
    /* Register a callback for LIN id received events */
    USART0_LINIdCallbackRegister(LIN_Id_Rcvd_Callback_Handler, (uintptr_t)NULL);

## Remarks

None