Report battery state in mV
This commit is contained in:
parent
51a95e7ffb
commit
aa653aecea
2
adc.c
2
adc.c
|
@ -20,7 +20,7 @@ void adc_setup(void) {
|
||||||
|
|
||||||
uint32_t adc_bat_voltage(void) {
|
uint32_t adc_bat_voltage(void) {
|
||||||
if (adc_get_flag(ADC1, ADC_SR_EOC)) {
|
if (adc_get_flag(ADC1, ADC_SR_EOC)) {
|
||||||
bat_voltage_mv = adc_read_regular(ADC1);
|
bat_voltage_mv = adc_read_regular(ADC1) * 3300 / 2048;
|
||||||
}
|
}
|
||||||
return bat_voltage_mv;
|
return bat_voltage_mv;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user