1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/stm32/periph_adc: support V_REFINT as ADC channel on L4

This commit is contained in:
Gunar Schorcht 2023-05-10 09:31:00 +02:00
parent 6247b2aea4
commit caa50a57e6

View File

@ -231,6 +231,11 @@ int32_t adc_sample(adc_t line, adc_res_t res)
if (IS_USED(MODULE_PERIPH_VBAT) && line == VBAT_ADC) {
vbat_enable();
}
#ifdef VREFINT_ADC
if (line == VREFINT_ADC) {
ADC->CCR |= ADC_CCR_VREFEN;
}
#endif
/* first clear resolution */
dev(line)->CFGR &= ~(ADC_CFGR_RES);
@ -253,6 +258,11 @@ int32_t adc_sample(adc_t line, adc_res_t res)
if (IS_USED(MODULE_PERIPH_VBAT) && line == VBAT_ADC) {
vbat_disable();
}
#ifdef VREFINT_ADC
if (line == VREFINT_ADC) {
ADC->CCR &= ~ADC_CCR_VREFEN;
}
#endif
/* free the device again */
done(line);