1.9.8.10 EVSYS_CallbackRegister Function

C

void EVSYS_CallbackRegister( EVSYS_CALLBACK callback, uintptr_t context )

Summary

Allows application to register a callback function

Description

This function allows the application to register a callback function that will be called when a event system interrupt has triggered. The callback feature is only available if the Interrupt operation in the GUI was enabled. If a callback mechanism is desired, then a callback function should be registered via this function before enabling other peripherals Calling this function at any time with callback function as NULL will disable the callback feature.

Precondition

The EVSYS_Initialize function must have been called. Interrupt option in MHC should have been enabled.

Parameters

Param Description
callBack Pointer to an application callback function
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 data object that identifies the instance of the client module (for example, it may be a pointer to the client modules state structure)

Returns

None.

Example

// This is the callback function that is called when an Event
// interrupt is triggered.

void evsysCallBack(uint32_t int_cause, uintptr_t contextHandle)
{
    if( int_cause & EVSYS_INT_EVD)
    {
        // Event detected
    }
    if( int_cause & EVSYS_INT_OVERRUN)
    {
        // Overrun error
    }
    
}

EVSYS_Initialize();
EVSYS_CallbackRegister(&evsysCallBack, NULL);

Remarks

The callback mechanism allows the application to implement an event based interaction with the library.