2.131.45 USARTx_LINTcCallbackRegister Function

C

/* x = USART LIN instance number */

/* USART LIN master/slave mode */

void USARTx_LINTcCallbackRegister( 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 data 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 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 LIN Transfer Complete interrupt mode is enabled.

Parameters

ParamDescription
callbackA pointer to a function with a calling signature defined by the USART_LIN_CALLBACK data type. Setting this to NULL disables the callback feature.
contextA 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_DataTransferComplete_Callback_Handler( uintptr_t context)
{
    LINDataTransferComplete = true;
}
USART0_Initialize();
USART0_LINTcCallbackRegister(LIN_DataTransferComplete_Callback_Handler, (uintptr_t)NULL);
USART0_Write(txBuffer, nTxBytes);

Remarks

None