Jump to main content

##

# 2.131.44 USARTx_LINIdCallbackRegister Function

## C

    /* x = USART LIN instance number */

    /* USART LIN master/slave mode */

    void USARTx_LINIdCallbackRegister( USART_LIN_CALLBACK callback, uintptr_t context)

## Summary

This function allows application to register a callback function for the PLIB to call back when the requested LIN ID transfer operation has completed.

## Description

This function sets the pointer to a client/application function to be called "back" when the given USARTx_LIN's Id transfer events occur. It also passes a context value (usually a pointer to a context structure) that is passed into the function when it is called. The specified callback function will be called from the peripheral interrupt context. The callback should be registered before a transfer operation is requested.

## Precondition

The USARTx_Initialize function must have been called. This function is only available if LIN ID interrupt mode is enabled.

## Parameters

Param | Description
--- | ---
callback | A pointer to a function with a calling signature defined by the USART_LIN_CALLBACK data type. Setting this to NULL disables the callback feature.
context | A value (usually a pointer) which is passed (unused) into the function identified by the callback parameter

## Returns

None.

## Example

    uint8_t txBuffer[10];
    uint8_t nTxBytes = 0;
    void LIN_Id_Tx_Callback_Handler( uintptr_t context)
    {
        LINIdTransferComplete = true;
    }
    USART0_Initialize();
    USART0_LINIdCallbackRegister(LIN_Id_Tx_Callback_Handler, (uintptr_t)NULL);
    USART0_Write(txBuffer, nTxBytes);

## Remarks

None