summaryrefslogtreecommitdiff
path: root/flash/bootbox/main.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-10-30 11:33:38 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-10-30 11:33:38 +0000
commit9e8fe0e4c662d3d5c26ea2f1f64c7da66cf3ce04 (patch)
treee5b0bd4076b66c55b49f36cdd0898de2e2717a86 /flash/bootbox/main.c
parentede3d646b9a248a1893ec20482eaa30641df078e (diff)
downloadrockbox-9e8fe0e4c662d3d5c26ea2f1f64c7da66cf3ce04.tar.gz
rockbox-9e8fe0e4c662d3d5c26ea2f1f64c7da66cf3ce04.zip
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
Diffstat (limited to 'flash/bootbox/main.c')
-rw-r--r--flash/bootbox/main.c15
1 files changed, 5 insertions, 10 deletions
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)
99 lcd_puts(0, 0, msg); 99 lcd_puts(0, 0, msg);
100 { 100 {
101 char buf[32]; 101 char buf[32];
102 int battery_voltage; 102 int battv = battery_voltage();
103 int batt_int, batt_frac;
104 battery_voltage = (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) / 10000;
105 batt_int = battery_voltage / 100;
106 batt_frac = battery_voltage % 100;
107
108 snprintf(buf, sizeof(buf), "%d.%02dV %d%%", 103 snprintf(buf, sizeof(buf), "%d.%02dV %d%%",
109 batt_int, batt_frac, battery_level()); 104 battv / 100, battv % 100, battery_level());
110 lcd_puts(0, 1, buf); 105 lcd_puts(0, 1, buf);
111 } 106 }
112 107
113#ifdef HAVE_LCD_BITMAP 108#ifdef HAVE_LCD_BITMAP
114 lcd_update(); 109 lcd_update();
115#endif 110#endif
116 111
117 button = button_get_w_tmo(HZ/2); 112 button = button_get_w_tmo(HZ/2);
118#ifdef BUTTON_ON 113#ifdef BUTTON_ON
119 if (button == (BUTTON_ON | BUTTON_REL)) 114 if (button == (BUTTON_ON | BUTTON_REL))
@@ -144,7 +139,7 @@ void prompt_usb(const char* msg1, const char* msg2)
144 lcd_puts(0, 3, "and fix it."); 139 lcd_puts(0, 3, "and fix it.");
145 lcd_update(); 140 lcd_update();
146#endif 141#endif
147 do 142 do
148 { 143 {
149 button = button_get(true); 144 button = button_get(true);
150 if (button == SYS_POWEROFF) 145 if (button == SYS_POWEROFF)
@@ -215,7 +210,7 @@ void main(void)
215 } 210 }
216 211
217 { // rolo the firmware 212 { // rolo the firmware
218 static const char filename[] = "/" BOOTFILE; 213 static const char filename[] = "/" BOOTFILE;
219 rolo_load((char*)filename); /* won't return if started */ 214 rolo_load((char*)filename); /* won't return if started */
220 215
221 prompt_usb("No firmware", filename); 216 prompt_usb("No firmware", filename);