From cdacab3d89cdbbd8fd7c20b3b340e27352e6737e Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Thu, 19 Jan 2006 07:47:34 +0000 Subject: Charging state reporting on H3x0 Don't read the GPIO every refresh of statusbar or gwps for plugged state, use a variable exported from powermgmt instead. Allow Custom WPS to access %bc for battery charge state on targets that support this. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8383 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/powermgmt.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'firmware/export/powermgmt.h') diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 3c4a61fb87..25c18eabad 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -79,18 +79,38 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute #endif /* HAVE_CHARGE_CTRL */ -#if defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) +#if defined(HAVE_CHARGE_CTRL) || \ + (CONFIG_BATTERY == BATT_LIION2200) || \ + defined(HAVE_CHARGE_STATE) typedef enum { DISCHARGING, CHARGING, +#ifdef HAVE_CHARGE_CTRL TOPOFF, TRICKLE +#endif } charge_state_type; /* tells what the charger is doing */ extern charge_state_type charge_state; #endif /* defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) */ +#ifdef HAVE_CHARGING +/* + * Flag that the charger has been plugged in/removed: this is set for exactly + * one time through the power loop when the charger has been plugged in. + */ +typedef enum { + NO_CHARGER, + CHARGER_UNPLUGGED, /* transient state */ + CHARGER_PLUGGED, /* transient state */ + CHARGER +} charger_input_state_type; + +/* tells the state of the charge input */ +extern charger_input_state_type charger_input_state; +#endif + #ifdef HAVE_MMC /* Values for Ondio */ # define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */ # define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */ @@ -106,9 +126,13 @@ extern charge_state_type charge_state; # define CURRENT_MIN_CHG 70 /* minimum charge current */ # define MIN_CHG_V 8500 /* at 8.5v charger voltage get CURRENT_MIN_CHG */ -# define CURRENT_MAX_CHG 350 /* maximum charging current */ +# ifdef IRIVER_H300_SERIES +# define CURRENT_MAX_CHG 650 /* maximum charging current */ +# else +# define CURRENT_MAX_CHG 350 /* maximum charging current */ +# endif # define MAX_CHG_V 10250 /* anything over 10.25v gives CURRENT_MAX_CHG */ -#endif /* HAVE_MMC */ +#endif /* not HAVE_MMC */ extern unsigned int bat; /* filtered battery voltage, centivolts */ extern unsigned short power_history[POWER_HISTORY_LEN]; -- cgit v1.2.3