From 9e8fe0e4c662d3d5c26ea2f1f64c7da66cf3ce04 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Mon, 30 Oct 2006 11:33:38 +0000 Subject: General: changed local adc to voltage conversions in several places to use battery_voltage. Added battery_read_info function for unfiltered battery information. x5: removed adc_read as a distinct function. Removed adc tick task. adc_init is empty inline. Adjusted battery scale, voltage to level array and read 10 bits from the ADC for battery since 255 levels is not enough for true centivolt resolution. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11396 a1c6a512-1295-4272-9138-f99709370657 --- flash/bootbox/main.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'flash/bootbox/main.c') diff --git a/flash/bootbox/main.c b/flash/bootbox/main.c index 4f5efdd7c6..af822b4a64 100644 --- a/flash/bootbox/main.c +++ b/flash/bootbox/main.c @@ -99,21 +99,16 @@ void charging_screen(void) lcd_puts(0, 0, msg); { char buf[32]; - int battery_voltage; - int batt_int, batt_frac; - battery_voltage = (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) / 10000; - batt_int = battery_voltage / 100; - batt_frac = battery_voltage % 100; - + int battv = battery_voltage(); snprintf(buf, sizeof(buf), "%d.%02dV %d%%", - batt_int, batt_frac, battery_level()); + battv / 100, battv % 100, battery_level()); lcd_puts(0, 1, buf); } #ifdef HAVE_LCD_BITMAP lcd_update(); #endif - + button = button_get_w_tmo(HZ/2); #ifdef BUTTON_ON if (button == (BUTTON_ON | BUTTON_REL)) @@ -144,7 +139,7 @@ void prompt_usb(const char* msg1, const char* msg2) lcd_puts(0, 3, "and fix it."); lcd_update(); #endif - do + do { button = button_get(true); if (button == SYS_POWEROFF) @@ -215,7 +210,7 @@ void main(void) } { // rolo the firmware - static const char filename[] = "/" BOOTFILE; + static const char filename[] = "/" BOOTFILE; rolo_load((char*)filename); /* won't return if started */ prompt_usb("No firmware", filename); -- cgit v1.2.3