stm32f3: adc: support voltage regulator on/off

The "Intermediate" value isn't a value you can do anything with, you need to
clear those bits when making changes.
This commit is contained in:
Karl Palsson
2015-10-19 00:43:00 +00:00
parent 6eb846d356
commit 7373d3ad58
2 changed files with 29 additions and 3 deletions

View File

@@ -1197,5 +1197,30 @@ void adc_disable_temperature_sensor()
/*---------------------------------------------------------------------------*/
/**
* Enable the ADC Voltage regulator
* Before any use of the ADC, the ADC Voltage regulator must be enabled.
* You must wait up to 10uSecs afterwards before trying anything else.
* @param[in] adc ADC block register address base
* @sa adc_disable_regulator
*/
void adc_enable_regulator(uint32_t adc)
{
ADC_CR(adc) &= ~ADC_CR_ADVREGEN_MASK;
ADC_CR(adc) |= ADC_CR_ADVREGEN_ENABLE;
}
/**
* Disable the ADC Voltage regulator
* You can disable the adc vreg when not in use to save power
* @param[in] adc ADC block register address base
* @sa adc_enable_regulator
*/
void adc_disable_regulator(uint32_t adc)
{
ADC_CR(adc) &= ~ADC_CR_ADVREGEN_MASK;
ADC_CR(adc) |= ADC_CR_ADVREGEN_DISABLE;
}
/**@}*/