summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-06-06 22:23:52 +0000
committerJens Arnold <amiconn@rockbox.org>2006-06-06 22:23:52 +0000
commit0dd1f8ec11f28fe34c93ba97af95eb2be2fef44f (patch)
treee3e77d4e6b25b82c82b3570cd8c4a988c7788e66 /firmware/export
parent8c9e22580e220b793130ed3ac67b9c54e85b3d0f (diff)
downloadrockbox-0dd1f8ec11f28fe34c93ba97af95eb2be2fef44f.zip
rockbox-0dd1f8ec11f28fe34c93ba97af95eb2be2fef44f.tar.gz
rockbox-0dd1f8ec11f28fe34c93ba97af95eb2be2fef44f.tar.bz2
rockbox-0dd1f8ec11f28fe34c93ba97af95eb2be2fef44f.tar.xz
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
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config-fmrecorder.h4
-rw-r--r--firmware/export/config-gigabeat.h4
-rw-r--r--firmware/export/config-gmini120.h4
-rw-r--r--firmware/export/config-gminisp.h4
-rw-r--r--firmware/export/config-h100.h8
-rw-r--r--firmware/export/config-h120.h8
-rw-r--r--firmware/export/config-h300.h10
-rw-r--r--firmware/export/config-iaudiox5.h4
-rw-r--r--firmware/export/config-ifp7xx.h4
-rw-r--r--firmware/export/config-ipod3g.h4
-rw-r--r--firmware/export/config-ipod4g.h4
-rw-r--r--firmware/export/config-ipodcolor.h4
-rw-r--r--firmware/export/config-ipodmini.h4
-rwxr-xr-xfirmware/export/config-ipodmini2g.h4
-rw-r--r--firmware/export/config-ipodnano.h4
-rw-r--r--firmware/export/config-ipodvideo.h6
-rw-r--r--firmware/export/config-player.h4
-rw-r--r--firmware/export/config-recorder.h7
-rw-r--r--firmware/export/config-recorderv2.h4
-rw-r--r--firmware/export/config.h5
-rw-r--r--firmware/export/power.h6
-rw-r--r--firmware/export/powermgmt.h22
22 files changed, 58 insertions, 70 deletions
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index 8711640..7a78d48 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 83a92ce..1ebbdbf 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 42424bb..66ba7af 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 e066661..8df7b0f 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 d53adce..4461cc2 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 34f5059..f2cd8c2 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 ae1940c..7ed5495 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 4690feb..b16a142 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 9e5a432..6247625 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 a611dfd..b3b5d14 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 fa664ac..46abbdf 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 b8f3d89..e063e93 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 64be801..4871ea0 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 454309a..adbb097 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 b7116bf..3d4deb3 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 1bbcfec..79ef1a8 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 324a0a2..3dfdb0e 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 92dd076..854b1c1 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 b508836..09823cf 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 d919b8b..910aeca 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 be8ebda..dc6c09d 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 6c31aee..30fe60c 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.