Skip to content

Commit

Permalink
Fix ADC internal junction temp calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Apehaenger committed Jul 29, 2024
1 parent b3dbb19 commit db60b39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modm/platform/adc/stm32f0/adc_impl.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ modm::platform::Adc{{ id }}::readTemperature(uint16_t Vref)
const int32_t value = (int32_t(*TS_CAL1) - (TS_DATA * Vref / VDDA_CAL)) * 1000;
return value / TS_AVG_SLOPE + TS_CAL1_TEMP;
%% elif target.family == "c0"
const int32_t value = (TS_DATA * Vref / VDDA_CAL) - int32_t(*TS_CAL1);
const int32_t value = ((TS_DATA * Vref / VDDA_CAL) - int32_t(*TS_CAL1)) * 1000;
return (value / TS_AVG_SLOPE) + TS_CAL1_TEMP;
%% else
const int32_t value = int32_t(TS_CAL2_TEMP - TS_CAL1_TEMP) * (TS_DATA * Vref / VDDA_CAL - *TS_CAL1);
Expand Down

0 comments on commit db60b39

Please sign in to comment.