stm32: adc-v2: pull up temp/vref switches

Common for f0,f3,l0,l4
This commit is contained in:
Karl Palsson
2015-10-24 00:16:35 +00:00
parent 7231b9a691
commit 1d090c840f
6 changed files with 45 additions and 83 deletions

View File

@@ -137,3 +137,44 @@ void adc_set_single_conversion_mode(uint32_t adc)
{
ADC_CFGR1(adc) &= ~ADC_CFGR1_CONT;
}
/**
* Enable the temperature sensor (only)
* The channel this is available on is unfortunately not
* consistent, even though the bit used to enable it is.
* @sa adc_disable_temperature_sensor
*/
void adc_enable_temperature_sensor(void)
{
ADC_CCR(ADC1) |= ADC_CCR_TSEN;
}
/**
* Disable the temperature sensor (only)
* @sa adc_enable_temperature_sensor
*/
void adc_disable_temperature_sensor(void)
{
ADC_CCR(ADC1) &= ~ADC_CCR_TSEN;
}
/**
* Enable the internal voltage reference (only)
* The channel this is available on is unfortunately not
* consistent, even though the bit used to enable it is.
* FIXME - on f3, you can actually have it on ADC34 as well!
* @sa adc_disable_vrefint
*/
void adc_enable_vrefint(void)
{
ADC_CCR(ADC1) |= ADC_CCR_VREFEN;
}
/**
* Disable the internal voltage reference (only)
* @sa adc_enable_vrefint
*/
void adc_disable_vrefint(void)
{
ADC_CCR(ADC1) &= ~ADC_CCR_VREFEN;
}