1.6.1.8 AC_CALLBACK Typedef

C

typedef void (*AC_CALLBACK) (uint8_t int_flags, uintptr_t context);

Summary

Pointer to a AC callback function

Description

This data type defines the required function signature for the AC callback function. Application must register a pointer to a callback function whose function signature (parameter and return value types) match the types specified by this function pointer in order to receive callback from the PLIB.

Parameters

Param Description
int_flags Flag to check Comparator Current State
context Value identifying the context of the application that registered the callback function

Returns

None.

Example

uintptr_t comparator_context;
void ac_callBack(uint8_t int_flag, uintptr_t ac_context)
{
     // Check the comparator output state 
     if(int_flag & AC_STATUSA_STATE_Msk)
     {
       ...
     } 
}
// Add the following after SYS_Initialize (NULL) in the main code

AC_CallbackRegister (ac_callBack, comparator_context);

Remarks

The context parameter contains the handle to the client context, provided at the time the callback function was registered using the AC_CallbackRegister function. This context handle value is passed back to the client as the "context" parameter. It can be any value (such as a pointer to the client's data) necessary to identify the client context or instance of the client that uses the AC peripheral.

The callback function executes in the PLIB's interrupt context. It is recommended of the application to not perform process intensive or blocking operations with in this function.