/*******************************************************************************
* Function Name: ADC_SAR_Seq_1_Start
********************************************************************************
*
* Summary:
*  Performs all required initialization for this component
*  and enables the power. The power will be set to the appropriate
*  power based on the clock frequency.
*
* Parameters:
*  None.
*
* Return:
*  None.
*
* Global variables:
*  The ADC_SAR_Seq_1_initVar variable is used to indicate when/if initial
*  configuration of this component has happened. The variable is initialized to
*  zero and set to 1 the first time ADC_Start() is called. This allows for
*  component Re-Start without re-initialization in all subsequent calls to the
*  ADC_SAR_Seq_1_Start() routine.
*  If re-initialization of the component is required the variable should be set
*  to zero before call of ADC_SAR_Seq_1_Start() routine, or the user may call
*  ADC_SAR_Seq_1_Init() and ADC_SAR_Seq_1_Enable() as done in the
*  ADC_SAR_Seq_1_Start() routine.
*
*******************************************************************************/
void ADC_SAR_Seq_1_Start(void)
{
    /* If not Initialized then initialize all required hardware and software */
    if(ADC_SAR_Seq_1_initVar == 0u)
    {
        ADC_SAR_Seq_1_Init();
        ADC_SAR_Seq_1_initVar = 1u;
    }
    ADC_SAR_Seq_1_Enable();
}
Esempio n. 2
0
/*******************************************************************************
* Function Name: ADC_SAR_Seq_1_Wakeup
********************************************************************************
*
* Summary:
*  Restores the component enable state and configuration registers.
*  This should be called just after awaking from sleep mode.
*
* Parameters:
*  None.
*
* Return:
*  None.
*
* Global Variables:
*  ADC_SAR_Seq_1_backup - used.
*
*******************************************************************************/
void ADC_SAR_Seq_1_Wakeup(void)
{
    ADC_SAR_Seq_1_SAR_DFT_CTRL_REG &= (uint32)~ADC_SAR_Seq_1_ADFT_OVERRIDE;
    if(ADC_SAR_Seq_1_backup.enableState != ADC_SAR_Seq_1_DISABLED)
    {
        /* Enable the SAR internal pump  */
        if((ADC_SAR_Seq_1_backup.enableState & ADC_SAR_Seq_1_BOOSTPUMP_ENABLED) != 0u)
        {
            ADC_SAR_Seq_1_SAR_CTRL_REG |= ADC_SAR_Seq_1_BOOSTPUMP_EN;
        }
        ADC_SAR_Seq_1_Enable();
        if((ADC_SAR_Seq_1_backup.enableState & ADC_SAR_Seq_1_STARTED) != 0u)
        {
            ADC_SAR_Seq_1_StartConvert();
        }
    }
}