diff options
| author | Brandon Low <lostlogic@rockbox.org> | 2006-01-19 07:47:34 +0000 |
|---|---|---|
| committer | Brandon Low <lostlogic@rockbox.org> | 2006-01-19 07:47:34 +0000 |
| commit | cdacab3d89cdbbd8fd7c20b3b340e27352e6737e (patch) | |
| tree | ad1746cf51bdb56a1cdcabf0c38eb6a53244c431 /firmware/export | |
| parent | 13414ae77a77d96ef2cb210d644880b847c9ca6f (diff) | |
| download | rockbox-cdacab3d89cdbbd8fd7c20b3b340e27352e6737e.zip rockbox-cdacab3d89cdbbd8fd7c20b3b340e27352e6737e.tar.gz rockbox-cdacab3d89cdbbd8fd7c20b3b340e27352e6737e.tar.bz2 rockbox-cdacab3d89cdbbd8fd7c20b3b340e27352e6737e.tar.xz | |
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
Diffstat (limited to 'firmware/export')
| -rw-r--r-- | firmware/export/config-h300.h | 3 | ||||
| -rw-r--r-- | firmware/export/power.h | 1 | ||||
| -rw-r--r-- | firmware/export/powermgmt.h | 30 |
3 files changed, 31 insertions, 3 deletions
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 806ae0a..ded20c9 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -72,6 +72,9 @@ /* Define this if the platform can charge batteries */ #define HAVE_CHARGING 1 +/* For units with a hardware charger that reports charge state */ +#define HAVE_CHARGE_STATE 1 + /* define this if the hardware can be powered off while charging */ #define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/power.h b/firmware/export/power.h index bf64552..9f91e25 100644 --- a/firmware/export/power.h +++ b/firmware/export/power.h @@ -25,6 +25,7 @@ extern bool charger_enabled; void power_init(void); bool charger_inserted(void); +bool charging_state(void); void charger_enable(bool on); void ide_power_enable(bool on); bool ide_powered(void); diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 3c4a61f..25c18ea 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]; |