Skip to content

Commit

Permalink
[stm32] Fix sampling time configuration in F3 ADC driver
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-durand committed Jan 2, 2024
1 parent 5e3acab commit 59437d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modm/platform/adc/stm32f3/adc_impl.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ modm::platform::Adc{{ id }}::configureChannel(Channel channel,
uint32_t tmpreg = 0;
if (static_cast<uint8_t>(channel) < 10) {
tmpreg = ADC{{ id }}->SMPR1
& ((~ADC_SMPR1_SMP0) << (static_cast<uint8_t>(channel) * 3));
& ~((ADC_SMPR1_SMP0) << (static_cast<uint8_t>(channel) * 3));
tmpreg |= static_cast<uint32_t>(sampleTime) <<
(static_cast<uint8_t>(channel) * 3);
ADC{{ id }}->SMPR1 = tmpreg;
}
else {
tmpreg = ADC{{ id }}->SMPR2
& ((~ADC_SMPR2_SMP10) << ((static_cast<uint8_t>(channel)-10) * 3));
& ~((ADC_SMPR2_SMP10) << ((static_cast<uint8_t>(channel)-10) * 3));
tmpreg |= static_cast<uint32_t>(sampleTime) <<
((static_cast<uint8_t>(channel)-10) * 3);
ADC{{ id }}->SMPR2 = tmpreg;
Expand Down

0 comments on commit 59437d1

Please sign in to comment.