stm32: Fix ADC on stm32h7 (#5239)

Don't reset the ADC peripheral if the clock is already enabled.
Fixes #5236

Signed-off-by: Aaron DeLyser <bluwolf@gmail.com>
This commit is contained in:
adelyser 2022-02-06 16:29:53 -07:00 committed by GitHub
parent 54646c77dc
commit 9174c0241e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -114,7 +114,9 @@ gpio_adc_setup(uint32_t pin)
ADC_TypeDef *adc;
if (chan >= 40){
adc = ADC3;
enable_pclock(ADC3_BASE);
if (!is_enabled_pclock(ADC3_BASE)) {
enable_pclock(ADC3_BASE);
}
MODIFY_REG(ADC3_COMMON->CCR, ADC_CCR_CKMODE_Msk,
0b11 << ADC_CCR_CKMODE_Pos);
} else if (chan >= 20){