diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-02 17:47:18 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-02 17:47:18 +0000 |
commit | e140424abc183403567b031a7da8b9b466fb4e95 (patch) | |
tree | 04ceb85531907afdfc42e9264321b4bf6e798760 /firmware | |
parent | 9b41dae0611988b24bf0e81f875dfdd3d33f94e5 (diff) | |
download | rockbox-e140424abc183403567b031a7da8b9b466fb4e95.tar.gz rockbox-e140424abc183403567b031a7da8b9b466fb4e95.zip |
Added battery measurement
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1307 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/debug.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/firmware/debug.c b/firmware/debug.c index c04deaa8b2..76fa67cc7c 100644 --- a/firmware/debug.c +++ b/firmware/debug.c | |||
@@ -229,6 +229,8 @@ void dbg_ports(void) | |||
229 | unsigned char portc; | 229 | unsigned char portc; |
230 | char buf[32]; | 230 | char buf[32]; |
231 | int button; | 231 | int button; |
232 | int battery_voltage; | ||
233 | int batt_int, batt_frac; | ||
232 | 234 | ||
233 | lcd_clear_display(); | 235 | lcd_clear_display(); |
234 | 236 | ||
@@ -244,15 +246,22 @@ void dbg_ports(void) | |||
244 | lcd_puts(0, 1, buf); | 246 | lcd_puts(0, 1, buf); |
245 | 247 | ||
246 | snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4)); | 248 | snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4)); |
247 | lcd_puts(0, 3, buf); | 249 | lcd_puts(0, 2, buf); |
248 | snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5)); | 250 | snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5)); |
249 | lcd_puts(0, 4, buf); | 251 | lcd_puts(0, 3, buf); |
250 | snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6)); | 252 | snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6)); |
251 | lcd_puts(0, 5, buf); | 253 | lcd_puts(0, 4, buf); |
252 | snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7)); | 254 | snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7)); |
255 | lcd_puts(0, 5, buf); | ||
256 | |||
257 | battery_voltage = (adc_read(6) * 6465) / 10000; | ||
258 | batt_int = battery_voltage / 100; | ||
259 | batt_frac = battery_voltage % 100; | ||
260 | |||
261 | snprintf(buf, 32, "Battery: %d.%02dV", batt_int, batt_frac); | ||
253 | lcd_puts(0, 6, buf); | 262 | lcd_puts(0, 6, buf); |
254 | 263 | ||
255 | snprintf(buf, 32, "%s : 0x%x", | 264 | snprintf(buf, 32, "ATA: %s, 0x%x", |
256 | ata_device?"slave":"master", ata_io_address); | 265 | ata_device?"slave":"master", ata_io_address); |
257 | lcd_puts(0, 7, buf); | 266 | lcd_puts(0, 7, buf); |
258 | 267 | ||