1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2006-06-06 22:23:52 +00:00
parent 8c9e22580e
commit 0dd1f8ec11
43 changed files with 300 additions and 350 deletions

View file

@ -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 */

View file

@ -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

View file

@ -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) */

View file

@ -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) */

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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

View file

@ -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.