1.5.11.8 FREQM_CALLBACK Typedef
C
typedef void (*FREQM_CALLBACK)(uintptr_t context)
Summary
Pointer to a FREQM CallBack function.
Description
This data type defines the required function signature for the FREQM event handling callback function. Application must register a pointer to an event handling function whose function signature (parameter and return value types) match the types specified by this function pointer in order to receive event calls back from the FREQM PLIB. The parameters and return values are described here and a partial example implementation is provided.
Parameters
Param | Description |
---|---|
context | Value identifying the context of the application that registered the event handling function |
Returns
None.
Example
// This is the callback function that is called when a frequency
// measurement is complete.
void FREQMCallBack(uintptr_t contextHandle)
{
if( FREQM_ERROR_NONE == FREQM_ErrorGet())
{
// Frequency measurement was completed without any errors. We can
// call the FREQM_FrequencyGet() function to obtain the measured
// value.
measuredFrequency = FREQM_FrequencyGet();
}
}
FREQM_Initialize();
FREQM_CallbackRegister(&FREQMCallBack, NULL);
FREQM_MeasurementStart();
Remarks
The context parameter can contain a handle to the client context, provided at the time the event handling function was registered using the FREQM_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 made the data exchange request. The callback function executes in the driver peripheral interrupt context when the driver is configured for interrupt mode operation. It is recommended of the application to not perform process intensive or blocking operations with in this function.