2.1.4.3 DRV_MCMETROLOGY_Open Function

C
DRV_MCMETROLOGY_RESULT DRV_MCMETROLOGY_Open (
    DRV_MCMETROLOGY_START_MODE mode, 
    DRV_MCMETROLOGY_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, 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_MCMETROLOGY_SUCCESS. Otherwise, it returns DRV_MCMETROLOGY_ERROR.

Example
    /* Detection of the WDOG0 Reset */
    if (RSTC_ResetCauseGet() == RSTC_SR_RSTTYP(RSTC_SR_RSTTYP_WDT0_RST_Val))
    {
        app_metrologyData.startMode = DRV_MCMETROLOGY_START_SOFT;
    }
    else
    {
        app_metrologyData.startMode = DRV_MCMETROLOGY_START_HARD;        
    }
    
    ...
    
    
        case APP_METROLOGY_STATE_INIT:
        {
            if (DRV_MCMETROLOGY_Open(app_metrologyData.startMode, NULL) == DRV_MCMETROLOGY_SUCCESS)
            {
                if (app_metrologyData.startMode == DRV_MCMETROLOGY_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_MCMETROLOGY_Initialize routine is called.