summaryrefslogtreecommitdiffstats
path: root/firmware/debug.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-07-02 17:47:18 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-07-02 17:47:18 +0000
commite140424abc183403567b031a7da8b9b466fb4e95 (patch)
tree04ceb85531907afdfc42e9264321b4bf6e798760 /firmware/debug.c
parent9b41dae0611988b24bf0e81f875dfdd3d33f94e5 (diff)
downloadrockbox-e140424abc183403567b031a7da8b9b466fb4e95.tar.gz
rockbox-e140424abc183403567b031a7da8b9b466fb4e95.tar.bz2
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/debug.c')
-rw-r--r--firmware/debug.c17
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)
unsigned char portc;
char buf[32];
int button;
+ int battery_voltage;
+ int batt_int, batt_frac;
lcd_clear_display();
@@ -244,15 +246,22 @@ void dbg_ports(void)
lcd_puts(0, 1, buf);
snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
- lcd_puts(0, 3, buf);
+ lcd_puts(0, 2, buf);
snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
- lcd_puts(0, 4, buf);
+ lcd_puts(0, 3, buf);
snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
- lcd_puts(0, 5, buf);
+ lcd_puts(0, 4, buf);
snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
+ lcd_puts(0, 5, buf);
+
+ battery_voltage = (adc_read(6) * 6465) / 10000;
+ batt_int = battery_voltage / 100;
+ batt_frac = battery_voltage % 100;
+
+ snprintf(buf, 32, "Battery: %d.%02dV", batt_int, batt_frac);
lcd_puts(0, 6, buf);
- snprintf(buf, 32, "%s : 0x%x",
+ snprintf(buf, 32, "ATA: %s, 0x%x",
ata_device?"slave":"master", ata_io_address);
lcd_puts(0, 7, buf);