Browse Source

stm32g0: adc: fix setting sampling time on all channels

Fixes: https://github.com/libopencm3/libopencm3/issues/1448
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
pull/1449/head
Karl Palsson 2 years ago
parent
commit
de96f0f4aa
  1. 2
      lib/stm32/g0/adc.c

2
lib/stm32/g0/adc.c

@ -69,7 +69,7 @@ void adc_set_sample_time_on_all_channels(uint32_t adc, uint8_t time)
reg32 = ADC_SMPR1(adc);
/* set all channels on ADC_SMPR_SMPSEL_SMP1 first @ref adc_smpr_smpsel sample time selection, and clear its value */
reg32 &= ~((ADC_SMPR_SMPSEL_MASK << ADC_SMPR_SMP1_SHIFT) | (ADC_SMPR_SMP1_MASK << ADC_SMPR_SMP1_SHIFT));
reg32 &= ~((ADC_SMPR_SMPSEL_MASK << ADC_SMPR_SMPSEL_SHIFT) | (ADC_SMPR_SMP1_MASK << ADC_SMPR_SMP1_SHIFT));
/* setup ADC_SMPR_SMPSEL_SMP1 sample time */
reg32 |= (time << ADC_SMPR_SMP1_SHIFT);
ADC_SMPR1(adc) = reg32;

Loading…
Cancel
Save