Skip to content

Commit

Permalink
fixup enableRegularConversionExternalTrigger
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-durand authored Mar 31, 2023
1 parent b2ade4b commit 8d240b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modm/platform/adc/stm32/adc_impl.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ modm::platform::Adc{{ id }}::enableRegularConversionExternalTrigger(
{
const auto externalTrigger =
(static_cast<uint32_t>(regularConversionExternalTrigger) << ADC_CR2_EXTSEL_Pos);
ADC{{ per }}->CR2 |= externalTrigger;
const auto mask = ADC_CR2_EXTSEL_Msk;
ADC{{ per }}->CR2 = (ADC{{ per }}->CR2 & ~mask) | externalTrigger;
}
%%else
void
Expand All @@ -283,7 +284,8 @@ modm::platform::Adc{{ id }}::enableRegularConversionExternalTrigger(
(static_cast<uint32_t>(externalTriggerPolarity) << ADC_CR2_EXTEN_Pos);
const auto externalTrigger =
(static_cast<uint32_t>(regularConversionExternalTrigger) << ADC_CR2_EXTSEL_Pos);
ADC{{ per }}->CR2 |= ( polarity | externalTrigger);
const auto mask = ADC_CR2_EXTEN_Msk | ADC_CR2_EXTSEL_Msk;
ADC{{ per }}->CR2 = (ADC{{ per }}->CR2 & ~mask) | polarity | externalTrigger;
}
%%endif

Expand Down

0 comments on commit 8d240b9

Please sign in to comment.