1.4.1.3 AC_CallbackRegister Function

C

void AC_CallbackRegister (AC_CALLBACK callback, uintptr_t context)

Summary

Allows application to register callback with PLIB

Description

This function allows application to register a callback function for the PLIB to call back when interrupt occurred.

At any point if application wants to stop the callback, it can call this function with "callback" value as NULL.

Precondition

AC_Initialize must have been called for the associated AC instance.

Parameters

Param Description
callback Pointer to the callback function implemented by the user.
context The value of parameter will be passed back to the application unchanged, when the callback function is called. It can be used to identify any application specific value that identifies the instance of the client module (for example, it may be a pointer to the client module's state structure)

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_STATE0_Msk)
    {
        ...
    }
}
// Add the following after SYS_Initialize (NULL) in the main code

AC_CallbackRegister(ac_callBack, comparator_context);

Remarks

None.