From 0dd1f8ec11f28fe34c93ba97af95eb2be2fef44f Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Tue, 6 Jun 2006 22:23:52 +0000 Subject: Work-in-progress rework of charging status reading & display: * Changed several charging related HAVE_* macros into one multi-value CONFIG_CHARGING. * Always use proper macros for charging states. * Battery symbol charging animation now starts from current level on all targets with charging. Two-colour animation kept for non-b&w targets. Round down fill level while charging as before, but round to nearest pixel value for discharging on all targets. * Charging anim fixed on player. * Some code cleanup. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10080 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-fmrecorder.h | 4 ++-- firmware/export/config-gigabeat.h | 4 ++-- firmware/export/config-gmini120.h | 4 ++-- firmware/export/config-gminisp.h | 4 ++-- firmware/export/config-h100.h | 8 +++----- firmware/export/config-h120.h | 8 +++----- firmware/export/config-h300.h | 10 ++-------- firmware/export/config-iaudiox5.h | 4 ++-- firmware/export/config-ifp7xx.h | 4 ++-- firmware/export/config-ipod3g.h | 4 ++-- firmware/export/config-ipod4g.h | 4 ++-- firmware/export/config-ipodcolor.h | 4 ++-- firmware/export/config-ipodmini.h | 4 ++-- firmware/export/config-ipodmini2g.h | 4 ++-- firmware/export/config-ipodnano.h | 4 ++-- firmware/export/config-ipodvideo.h | 6 ++---- firmware/export/config-player.h | 4 ++-- firmware/export/config-recorder.h | 7 ++----- firmware/export/config-recorderv2.h | 4 ++-- firmware/export/config.h | 5 +++++ firmware/export/power.h | 6 +++--- firmware/export/powermgmt.h | 22 ++++++++++------------ 22 files changed, 58 insertions(+), 70 deletions(-) (limited to 'firmware/export') diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index 8711640e93..7a78d48822 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h @@ -90,8 +90,8 @@ /* How to detect USB */ #define USB_FMRECORDERSTYLE 1 -/* Define this if the platform can charge batteries */ -#define HAVE_CHARGING 1 +/* Hardware controlled charging with monitoring */ +#define CONFIG_CHARGING CHARGING_MONITOR /* The start address index for ROM builds */ /* #define ROM_START 0x14010 for behind original Archos */ diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 83a92ce140..1ebbdbf908 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h @@ -61,8 +61,8 @@ #define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */ -/* Define this if the platform can charge batteries */ -#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ #define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-gmini120.h b/firmware/export/config-gmini120.h index 42424bb7b1..66ba7af09e 100644 --- a/firmware/export/config-gmini120.h +++ b/firmware/export/config-gmini120.h @@ -54,8 +54,8 @@ #define BATTERY_SCALE_FACTOR 6465 /* chosen values at random -- jyp */ -/* Define this if the platform can charge batteries */ -#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +#define CONFIG_CHARGING CHARGING_SIMPLE #define CPU_FREQ 30000000 /* approximate value (and false in general since freq is variable) */ diff --git a/firmware/export/config-gminisp.h b/firmware/export/config-gminisp.h index e066661061..8df7b0f5a1 100644 --- a/firmware/export/config-gminisp.h +++ b/firmware/export/config-gminisp.h @@ -45,8 +45,8 @@ #define BATTERY_SCALE_FACTOR 6465 /* chosen values at random -- jyp */ -/* Define this if the platform can charge batteries */ -#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +#define CONFIG_CHARGING CHARGING_SIMPLE #define CPU_FREQ 30000000 /* approximate value (and false in general since freq is variable) */ diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index d53adcec14..4461cc2d44 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -89,11 +89,9 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */ -/* 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 +/* Hardware controlled charging */ +//#define CONFIG_CHARGING CHARGING_SIMPLE +#define CONFIG_CHARGING CHARGING_MONITOR /* FIXME: remove that once monitoring is fixed properly */ /* define this if the hardware can be powered off while charging */ #define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index 34f5059b69..f2cd8c2665 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -84,11 +84,9 @@ /* Define if we have a hardware defect that causes ticking on the audio line */ #define HAVE_REMOTE_LCD_TICKING -/* 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 +/* Hardware controlled charging */ +//#define CONFIG_CHARGING CHARGING_SIMPLE +#define CONFIG_CHARGING CHARGING_MONITOR /* FIXME: remove that once monitoring is fixed properly */ /* define this if the hardware can be powered off while charging */ #define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index ae1940c987..7ed54958ca 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -85,14 +85,8 @@ /* Define if we have a hardware defect that causes ticking on the audio line */ #define HAVE_REMOTE_LCD_TICKING -/* 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 +/* Hardware controlled charging with monitoring */ +#define CONFIG_CHARGING CHARGING_MONITOR /* The size of the flash ROM */ #define FLASH_SIZE 0x400000 diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 4690feb8fe..b16a142a28 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h @@ -65,8 +65,8 @@ #define HAVE_TLV320 -/* Define this if the platform can charge batteries */ -#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ #define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h index 9e5a432260..6247625618 100644 --- a/firmware/export/config-ifp7xx.h +++ b/firmware/export/config-ifp7xx.h @@ -56,8 +56,8 @@ #define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */ -/* Define this if the platform can charge batteries */ -//#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +//#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index a611dfdcaa..b3b5d14e85 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -68,8 +68,8 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 -/* Define this if the platform can charge batteries */ -//#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +//#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index fa664acdb6..46abbdf72b 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h @@ -70,8 +70,8 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 -/* Define this if the platform can charge batteries */ -//#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +//#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index b8f3d89346..e063e93737 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h @@ -69,8 +69,8 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 -/* Define this if the platform can charge batteries */ -//#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +//#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 64be801577..4871ea0acc 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -70,8 +70,8 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 -/* Define this if the platform can charge batteries */ -//#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +//#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 454309a786..adbb0973ac 100755 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h @@ -73,8 +73,8 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 -/* Define this if the platform can charge batteries */ -//#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +//#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index b7116bf249..3d4deb3abd 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h @@ -74,8 +74,8 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 -/* Define this if the platform can charge batteries */ -//#define HAVE_CHARGING 1 +/* Hardware controlled charging? FIXME */ +//#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 1bbcfec157..79ef1a85ac 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h @@ -74,14 +74,12 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 -/* Define this if the platform can charge batteries */ -#define HAVE_CHARGING 1 +/* Hardware controlled charging with monitoring */ +#define CONFIG_CHARGING CHARGING_MONITOR /* define this if the hardware can be powered off while charging */ //#define HAVE_POWEROFF_WHILE_CHARGING -#define HAVE_CHARGE_STATE 1 - /* The start address index for ROM builds */ #define ROM_START 0x00000000 diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index 324a0a2300..3dfdb0e727 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h @@ -67,8 +67,8 @@ /* How to detect USB */ #define USB_PLAYERSTYLE 1 -/* Define this if the platform can charge batteries */ -#define HAVE_CHARGING 1 +/* Hardware controlled charging */ +#define CONFIG_CHARGING CHARGING_SIMPLE /* The start address index for ROM builds */ /* #define ROM_START 0xD010 for behind original Archos */ diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index 92dd07695d..854b1c1ade 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h @@ -45,9 +45,6 @@ /* Define this if you have a SH7034 */ #define CONFIG_CPU SH7034 -/* Define this if you have charging control */ -#define HAVE_CHARGE_CTRL - /* Define this if you have ATA power-off control */ #define HAVE_ATA_POWER_OFF @@ -80,8 +77,8 @@ /* How to detect USB */ #define USB_RECORDERSTYLE 1 -/* Define this if the platform can charge batteries */ -#define HAVE_CHARGING 1 +/* Software controlled charging */ +#define CONFIG_CHARGING CHARGING_CONTROL /* The start address index for ROM builds */ /* #define ROM_START 0x11010 for behind original Archos */ diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index b508836080..09823cffb2 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h @@ -90,8 +90,8 @@ /* How to detect USB */ #define USB_FMRECORDERSTYLE 1 -/* Define this if the platform can charge batteries */ -#define HAVE_CHARGING 1 +/* Hardware controlled charging with monitoring */ +#define CONFIG_CHARGING CHARGING_MONITOR /* The start address index for ROM builds */ /* #define ROM_START 0x12010 for behind original Archos */ diff --git a/firmware/export/config.h b/firmware/export/config.h index d919b8b4f6..910aeca4eb 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -68,6 +68,11 @@ #define BATT_3AAA 1000 /* Ondio */ #define BATT_LIPOL1300 1300 /* the type used in iRiver h1x0 models */ +/* CONFIG_CHARGING */ +#define CHARGING_SIMPLE 1 /* Simple, hardware controlled charging */ +#define CHARGING_MONITOR 2 /* Hardware controlled charging with monitoring */ +#define CHARGING_CONTROL 3 /* Software controlled charging */ + /* CONFIG_LCD */ #define LCD_GMINI100 0 #define LCD_SSD1815 1 /* as used by Archos Recorders and Ondios */ diff --git a/firmware/export/power.h b/firmware/export/power.h index be8ebda5b0..dc6c09d9f9 100644 --- a/firmware/export/power.h +++ b/firmware/export/power.h @@ -19,12 +19,12 @@ #ifndef _POWER_H_ #define _POWER_H_ -#ifdef HAVE_CHARGE_CTRL +#if CONFIG_CHARGING == CHARGING_CONTROL extern bool charger_enabled; void charger_enable(bool on); #endif -#ifdef HAVE_CHARGING +#ifdef CONFIG_CHARGING bool charger_inserted(void); #endif @@ -35,7 +35,7 @@ void ide_power_enable(bool on); void power_init(void); -# ifdef HAVE_CHARGE_STATE +# if CONFIG_CHARGING == CHARGING_MONITOR bool charging_state(void); # endif diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 6c31aeec52..30fe60c293 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -28,7 +28,7 @@ #ifndef SIMULATOR -#ifdef HAVE_CHARGE_CTRL +#if CONFIG_CHARGING == CHARGING_CONTROL #define START_TOPOFF_CHG 85 /* Battery % to start at top-off */ #define START_TRICKLE_CHG 95 /* Battery % to start at trickle */ @@ -59,23 +59,21 @@ extern int pid_p; /* PID proportional term */ extern int pid_i; /* PID integral term */ extern int trickle_sec; /* trickle charge: How many seconds per minute are we charging actually? */ -#endif /* HAVE_CHARGE_CTRL */ +#endif /* CONFIG_CHARGING == CHARGING_CONTROL */ -#if defined(HAVE_CHARGE_CTRL) || \ - (CONFIG_BATTERY == BATT_LIION2200) || \ - defined(HAVE_CHARGE_STATE) -typedef enum { - DISCHARGING, - CHARGING, - TOPOFF, - TRICKLE +#if CONFIG_CHARGING >= CHARGING_MONITOR +typedef enum { /* sorted by increasing charging current */ + DISCHARGING = 0, + TRICKLE, /* Can occur for CONFIG_CHARGING >= CHARGING_MONITOR */ + TOPOFF, /* Can occur for CONFIG_CHARGING == CHARGING_CONTROL */ + CHARGING /* Can occur for all CONFIG_CHARGING options */ } charge_state_type; /* tells what the charger is doing */ extern charge_state_type charge_state; -#endif /* defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) */ +#endif /* CONFIG_CHARGING >= CHARGING_MONITOR */ -#ifdef HAVE_CHARGING +#ifdef CONFIG_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. -- cgit v1.2.3