1.23.27.32 UART_CALLBACK Typedef

C

/* Non-blocking mode */

typedef void (*UART_CALLBACK)( uintptr_t context )

Summary

Defines the data type and function signature of the UART peripheral library callback function.

Description

This data type defines the function signature of the UART peripheral callback function. The UART peripheral will call back the client's function with this signature to notify the application when a transfer has completed or when a transfer error has occured.

Precondition

UARTx_Initialize must have been called for the given UART peripheral instance and UARTx_CallbackRegister must have been called to set the function to be called.

Parameters

Param Description
context Allows the caller to provide a context value (usually a pointer tothe callers context for multi-instance clients).

Returns

None.

Example

void UARTReadCallback(uintptr_t context)
{
    // This function will be called when a UART read has completed.
}

void UARTWriteCallback(uintptr_t context)
{
    // This function will be called when a UART write has completed.
}

UART1_ReadCallbackRegister(UARTReadCallback, 0);
UART1_WriteCallbackRegister(UARTWriteCallback, 0);

Remarks

Code within the callback function will execute in an interrupt context. The application should avoid calling hardware blocking functions or interrupt in-sensitive code in this function.