2.1.4.7 DRV_MCMETROLOGY_IntegrationCallbackRegister Function

C
DRV_MCMETROLOGY_RESULT DRV_MCMETROLOGY_IntegrationCallbackRegister (
    DRV_MCMETROLOGY_CALLBACK callback 
);
Summary

Allows a client to set a metrology integration event handling function for the driver to call back when a integration period has completed.

Description

This function allows a client to register an integration period event handling function with the driver to call back when a integration period has completed.

This function must be always called after DRV_MCMETROLOGY_Initialize routine is called, since the initialization routine sets a NULL pointer to indicate no callback.

Precondition

DRV_MCMETROLOGY_Initialize must have been called before.

Parameters
ParamDescription
callbackPointer to the callback function
Returns

If successful, returns DRV_MCMETROLOGY_SUCCESS. Otherwise, it returns DRV_MCMETROLOGY_ERROR.

Example
    staticvoid_APP_METROLOGY_NewIntegrationCallback(void)
    {
        if (app_metrologyData.state == APP_METROLOGY_STATE_RUNNING)
        {
            /* Signal Metrology thread to update measurements for an integration period */
            OSAL_SEM_PostISR(&appMetrologySemID);
        }
    }
      
    (...)
    
    /* Set Callback for each metrology integration process */
    DRV_MCMETROLOGY_IntegrationCallbackRegister(_APP_METROLOGY_NewIntegrationCallback);
Remarks

None.