diff options
author | adelyser <12093019+adelyser@users.noreply.github.com> | 2022-02-06 16:29:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-06 18:29:53 -0500 |
commit | 9174c0241e970db23384fdafab2403bc05adc946 (patch) | |
tree | 32d55b24a77393787b2fc2926d2cfdc97bc7a532 /src/stm32 | |
parent | 54646c77dc1b659614e9a8e27909da4b08ac8cee (diff) | |
download | kutter-9174c0241e970db23384fdafab2403bc05adc946.tar.gz kutter-9174c0241e970db23384fdafab2403bc05adc946.tar.xz kutter-9174c0241e970db23384fdafab2403bc05adc946.zip |
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>
Diffstat (limited to 'src/stm32')
-rw-r--r-- | src/stm32/stm32h7_adc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stm32/stm32h7_adc.c b/src/stm32/stm32h7_adc.c index 792a3335..2733b24f 100644 --- a/src/stm32/stm32h7_adc.c +++ b/src/stm32/stm32h7_adc.c @@ -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){ |