Skip to content

Commit

Permalink
add TSVREFE bit if temperature or internal reference channels is added
Browse files Browse the repository at this point in the history
  • Loading branch information
victorandrehc authored and salkinium committed Apr 8, 2023
1 parent 47bff54 commit e0c484f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/modm/platform/adc/stm32/adc_impl.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ modm::platform::Adc{{ id }}::setChannel(const Channel channel,
ADC{{ per }}->SQR3 = uint32_t(channel) & 0x1f;

setSampleTime(channel, sampleTime);
%% if temperature_available
if(channel == Channel::TemperatureSensor || channel == Channel::InternalReference)
{
enableTemperatureRefVMeasurement();
}
%%endif
return true;
}

Expand Down Expand Up @@ -129,6 +135,12 @@ modm::platform::Adc{{ id }}::addChannel(const Channel channel,
ADC{{ per }}->SQR1 = (ADC{{ per }}->SQR1 & ~ADC_SQR1_L) | (channel_count << 20);

setSampleTime(channel, sampleTime);
%% if temperature_available
if(channel == Channel::TemperatureSensor || channel == Channel::InternalReference)
{
enableTemperatureRefVMeasurement();
}
%%endif
return true;
}

Expand Down

0 comments on commit e0c484f

Please sign in to comment.