1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-29 00:11:16 +01:00

cpu/stm32l0: fix ADC initialization order

This commit is contained in:
crasbe 2024-11-18 20:54:53 +01:00
parent 76b9b711a8
commit 2f8b23a596

View File

@ -128,9 +128,6 @@ int32_t adc_sample(adc_t line, adc_res_t res)
/* lock and power on the ADC device */
prep();
/* Enable ADC */
_enable_adc();
/* Reactivate VREFINT and temperature sensor if necessary */
if (adc_config[line].chan == 17) {
ADC->CCR |= ADC_CCR_VREFEN;
@ -145,6 +142,9 @@ int32_t adc_sample(adc_t line, adc_res_t res)
ADC1->CFGR1 |= res & ADC_CFGR1_RES;
ADC1->CHSELR = (1 << adc_config[line].chan);
/* Enable ADC */
_enable_adc();
/* clear flag */
ADC1->ISR |= ADC_ISR_EOC;