/* Initializes the adc peripheral according to the specified parameters in the init_struct, Please use this function if you want to be compatible with older versions of the library.  */
void ADC_Init(ADC_TypeDef *adc, ADC_InitTypeDef *init_struct)
/* Initializes the adc peripheral according to the specified parameters in the init_struct, Please use this function if you want to be compatible with older versions of the library.  */
void ADC_Init(ADC_TypeDef *adc, ADC_InitTypeDef *init_struct)
{
    adc->ADCFG &= ~(ADC_CFGR_PRE | ADC_CFGR_RSLTCTL);
    adc->ADCFG |= (u32)(init_struct->ADC_PRESCARE) | init_struct->ADC_Resolution;
    adc->ADCR &= ~(ADC_CR_ALIGN | ADC_CR_MODE | ADC_CR_TRGSEL);
    adc->ADCR |= ((u32)init_struct->ADC_DataAlign) | init_struct->ADC_ExternalTrigConv | ((u32)init_struct->ADC_Mode);
}