Jump to main content

# 1.1.4.7 DRV_METROLOGY_IntegrationCallbackRegister Function

## C

    DRV_METROLOGY_RESULT DRV_METROLOGY_IntegrationCallbackRegister (
        DRV_METROLOGY_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_METROLOGY_Initialize routine is called, since the initialization routine sets a NULL pointer to indicate no callback.

## Precondition

DRV_METROLOGY_Initialize must have been called before.

## Parameters

Parameters | Description
--- | ---
callback | Pointer to the callback function

## Returns

If successful, returns DRV_METROLOGY_SUCCESS. Otherwise, it returns DRV_METROLOGY_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_METROLOGY_IntegrationCallbackRegister(_APP_METROLOGY_NewIntegrationCallback);

## Remarks

None.

Rev: E