1.1.3.4.3 DRV_METROLOGY_Open Function

C

DRV_METROLOGY_RESULT DRV_METROLOGY_Open (
    DRV_METROLOGY_START_MODE mode, 
    DRV_METROLOGY_CONTROL * pConfiguration
);

Summary

Opens the metrology driver according to the mode parameter.

Description

This routine enables the IPC peripheral and, only if a HARD start mode has been selected, also handles the reset and clock lines for enabling the metrology library application. On the other hand, SOFT mode does not any effects on metrology library application running in the second processor.

Parameters

ParamDescription
modeMetrology Driver Start mode.
pConfigurationPointer to CONTROL configuration to be loaded. In case of NULL, the MCC default configuration will be loaded.

Returns

If successful, returns DRV_METROLOGY_SUCCESS. Otherwise, it returns DRV_METROLOGY_ERROR.

Example

    /* Detection of the WDOG0 Reset */
    if (RSTC_ResetCauseGet() == RSTC_SR_RSTTYP(RSTC_SR_RSTTYP_WDT0_RST_Val))
    {
        app_metrologyData.startMode = DRV_METROLOGY_START_SOFT;
    }
    else
    {
        app_metrologyData.startMode = DRV_METROLOGY_START_HARD;        
    }
    
    ...
    
    
        case APP_METROLOGY_STATE_INIT:
        {
            if (DRV_METROLOGY_Open(app_metrologyData.startMode, NULL) == DRV_METROLOGY_SUCCESS)
            {
                if (app_metrologyData.startMode == DRV_METROLOGY_START_HARD)
                {
                    app_metrologyData.state = APP_METROLOGY_STATE_START;
                }
                else
                {
                    app_metrologyData.state = APP_METROLOGY_STATE_RUNNING;
                }
            }
            else
            {
                app_metrologyData.state = APP_METROLOGY_STATE_ERROR;
            }

            break;
        }

Remarks

This routine must be called after DRV_METROLOGY_Initialize routine is called.