Jump to main content

##

# 2.131.43 USARTx_LINBreakCallbackRegister Function

## C

    /* x = USART LIN instance number */

    /* USART LIN master/slave mode */

    void USARTx_LINBreakCallbackRegister( 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 Break Field of the requested LIN header transfer operation has completed.

## Description

This function sets the pointer to a client/application function to be called "back" when the Break Field of USARTx_LIN's data 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 the LIN Break 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_BreakFieldTransferComplete_Callback_Handler( uintptr_t context)
    {
        LINBreakFieldTransferComplete = true;
    }
    USART0_Initialize();
    USART0_LINTcCallbackRegister(LIN_BreakFieldTransferComplete_Callback_Handler, (uintptr_t)NULL);
    USART0_Write(txBuffer, nTxBytes);

## Remarks

None