Now uses power.c/h

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1334 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-07-04 16:09:53 +00:00
parent 7cafe7aa2f
commit 5b4221b279

View file

@ -34,6 +34,7 @@ static char debugbuf[200];
#include "lcd.h" #include "lcd.h"
#include "adc.h" #include "adc.h"
#include "mas.h" #include "mas.h"
#include "power.h"
void debug_init(void) void debug_init(void)
{ {
@ -230,6 +231,8 @@ void dbg_ports(void)
int button; int button;
int battery_voltage; int battery_voltage;
int batt_int, batt_frac; int batt_int, batt_frac;
bool charge_status = false;
bool ide_status = true;
lcd_clear_display(); lcd_clear_display();
@ -257,7 +260,8 @@ void dbg_ports(void)
batt_int = battery_voltage / 100; batt_int = battery_voltage / 100;
batt_frac = battery_voltage % 100; batt_frac = battery_voltage % 100;
snprintf(buf, 32, "Battery: %d.%02dV", batt_int, batt_frac); snprintf(buf, 32, "Batt: %d.%02dV %d%% ", batt_int, batt_frac,
battery_level());
lcd_puts(0, 6, buf); lcd_puts(0, 6, buf);
snprintf(buf, 32, "ATA: %s, 0x%x", snprintf(buf, 32, "ATA: %s, 0x%x",
@ -271,16 +275,19 @@ void dbg_ports(void)
switch(button) switch(button)
{ {
case BUTTON_ON:
charge_status = charge_status?false:true;
charger_enable(charge_status);
break;
case BUTTON_UP: case BUTTON_UP:
/* Toggle the IDE power */ ide_status = ide_status?false:true;
PADR ^= 0x20; ide_power_enable(ide_status);
break; break;
case BUTTON_OFF: case BUTTON_OFF:
/* Disable the charger */ charger_enable(false);
PBDR |= 0x20; ide_power_enable(true);
/* Enable the IDE power */
PADR |= 0x20;
return; return;
} }
} }