/* Config the ADC peripheral according to the specified parameters in the adcConfig.  */
void ADC_Config(ADC_T *adc, ADC_Config_T *adcConfig)
/* Config the ADC peripheral according to the specified parameters in the adcConfig.  */
void ADC_Config(ADC_T *adc, ADC_Config_T *adcConfig)
{
    uint32_t reg;
    reg = adc->CTRL1;
    reg &= 0xFFF0FEFF;
    reg |= (uint32_t)((adcConfig->mode) | ((uint32_t)adcConfig->scanConvMode << 8));
    adc->CTRL1 = reg;
    reg = adc->CTRL2;
    reg &= 0xFFF1F7FD;
    reg |= (uint32_t)(adcConfig->dataAlign | adcConfig->externalTrigConv |
                    ((uint32_t)adcConfig->continuosConvMode << 1));
    adc->CTRL2 = reg;
    reg = adc->REGSEQ1;
    reg &= 0xFF0FFFFF;
    reg |= (uint32_t)((adcConfig->nbrOfChannel - (uint8_t)1) << 20);
    adc->REGSEQ1 = reg;
}