/* Active the Calibration operation for the selected ADC.  */
uint32_t ADC_GetCalibrationFactor(ADC_TypeDef *ADCx)
/* Active the Calibration operation for the selected ADC.  */
uint32_t ADC_GetCalibrationFactor(ADC_TypeDef *ADCx)
{
  uint32_t tmpreg = 0, calibrationcounter = 0, calibrationstatus = 0;
  assert_param(IS_ADC_ALL_PERIPH(ADCx));
  ADCx->CR |= (uint32_t)ADC_CR_ADCAL;
  do
  {
    calibrationstatus = ADCx->CR & ADC_CR_ADCAL;
    calibrationcounter++;
  } while((calibrationcounter != CALIBRATION_TIMEOUT) && (calibrationstatus != 0x00));
  if((uint32_t)(ADCx->CR & ADC_CR_ADCAL) == RESET)
  {
    tmpreg = ADCx->DR;
  }
  else
  {
    tmpreg = 0x00000000;
  }
  return tmpreg;
}