drivers: adc_stm32: Get clock frequency from DTS

The adc_stm32 driver used system timer frequency as a base for
busy-wait delay calculation. This commit corrects that by obtaining
the needed value from SystemCoreClock variable.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit is contained in:
Piotr Zięcik 2019-05-30 12:16:18 +02:00 committed by Carles Cufí
commit 70d61cdd55

View file

@ -557,7 +557,7 @@ static int adc_stm32_init(struct device *dev)
LOG_ERR("ADC clock rate get error.");
}
wait_cycles = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / adc_rate *
wait_cycles = SystemCoreClock / adc_rate *
LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES;
for (int i = wait_cycles; i >= 0; i--) {