X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=bike-lights.git;a=blobdiff_plain;f=firmware%2Fbattery.c;fp=firmware%2Fbattery.c;h=01337db1bb8c196fde0d0ff3efa61b1457bce7a8;hp=284c096b34230b38f53702539d6ed4792f901dcb;hb=c919c204874b9455471744eb6b802534ed629fcc;hpb=500478f9e0e03686dccde2fbbe7522593ba5cce5 diff --git a/firmware/battery.c b/firmware/battery.c index 284c096..01337db 100644 --- a/firmware/battery.c +++ b/firmware/battery.c @@ -23,8 +23,8 @@ void battery_adc(uint16_t adcval) * is coarse (0.1 V). */ battery_100mv = (unsigned char) - ((uint16_t)(adcval * 11 // 1.1V + ((uint16_t)(adcval * (11 // 1.1V * (RESISTOR_HI+RESISTOR_LO)/RESISTOR_LO // resistor ratio - / 4) >> 8); // divide by 1024 + / 4)) >> 8); // divide by 1024 }