From 90e738a3379d258a48a7c92f6708040fc39c373a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 23 Oct 2011 15:20:50 -0700 Subject: [PATCH] altos: Fix battery voltage computation. Full scale is 4.95V, not 3.333V. Signed-off-by: Keith Packard --- src/cc1111/ao_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc1111/ao_battery.c b/src/cc1111/ao_battery.c index 070f682f..b9845fb3 100644 --- a/src/cc1111/ao_battery.c +++ b/src/cc1111/ao_battery.c @@ -36,7 +36,7 @@ ao_battery_get(void) ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | BATTERY_PIN; ao_sleep(DATA_TO_XDATA(&ao_battery_value)); ); - return (uint16_t) ((int32_t) ao_battery_value.v * (int32_t) 3333 >> 15); + return (uint16_t) ((int32_t) ao_battery_value.v * (int32_t) 4950 >> 15); } static void -- 2.30.2