1 parent 99bcaa2 commit 91fc4a9Copy full SHA for 91fc4a9
1 file changed
stmhal/adc.c
@@ -353,7 +353,8 @@ float adc_read_core_vbat(ADC_HandleTypeDef *adcHandle) {
353
// be 12-bits.
354
raw_value <<= (12 - adc_get_resolution(adcHandle));
355
356
- return raw_value * VBAT_DIV / 4096.0f * 3.3f;
+ // multiplier is 3.3/4095
357
+ return raw_value * VBAT_DIV * 0.8058608058608059e-3f;
358
}
359
360
float adc_read_core_vref(ADC_HandleTypeDef *adcHandle) {
@@ -363,7 +364,8 @@ float adc_read_core_vref(ADC_HandleTypeDef *adcHandle) {
363
364
365
366
- return raw_value / 4096.0f * 3.3f;
367
368
+ return raw_value * 0.8058608058608059e-3f;
369
370
#endif
371
0 commit comments