1.41.5.33 FLEXCOM_USART_CALLBACK Typedef

C

/* Non-blocking mode */

typedef void (*FLEXCOM_USART_CALLBACK)( uintptr_t context );

Summary

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

Description

This data type defines the function signature of the USART peripheral callback function. The USART 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

FLEXCOMx_USART_Initialize must have been called for the given USART peripheral instance and FLEXCOMx_USART_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 USARTReadCallback(uintptr_t context)
{
    // This function will be called when a USART read has completed.
}

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

FLEXCOM0_USART_ReadCallbackRegister(USARTReadCallback, (uintptr_t)0);
FLEXCOM0_USART_WriteCallbackRegister(USARTWriteCallback, (uintptr_t)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.