summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2006-11-11 01:18:57 +0000
committerBarry Wardell <rockbox@barrywardell.net>2006-11-11 01:18:57 +0000
commit8d2711b7d2d9f19dc2375bd9395359ed725375ab (patch)
tree788f6dc4e010f7cf6eac2e3a5d3eebe2427fe06e /firmware/export
parentb3d2017057a47b1a5863d4e18e8d3eaf6a2fb63a (diff)
downloadrockbox-8d2711b7d2d9f19dc2375bd9395359ed725375ab.tar.gz
rockbox-8d2711b7d2d9f19dc2375bd9395359ed725375ab.zip
Improved power management (FS#3001). Shutdown rockbox when the battery gets to a level where the device doesn't function properly. Calculate remaining charging time while charging (rather than remaining running time). Show "Low Battery" and "Battery Empty" warnings. Also fixes FS#4786.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11507 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/powermgmt.h34
1 files changed, 24 insertions, 10 deletions
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index ba2cc02318..fc7a0de171 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -94,13 +94,25 @@ extern charger_input_state_type charger_input_state;
94# define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */ 94# define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */
95# define CURRENT_BACKLIGHT 0 /* no backlight */ 95# define CURRENT_BACKLIGHT 0 /* no backlight */
96#else /* Values for HD based jukeboxes */ 96#else /* Values for HD based jukeboxes */
97# ifdef IRIVER_H100_SERIES 97#ifdef IRIVER_H100_SERIES
98# define CURRENT_NORMAL 80 98# define CURRENT_NORMAL 80 /* 16h playback on 1300mAh battery */
99# else 99# define CURRENT_BACKLIGHT 23 /* from IriverBattery twiki page */
100# define CURRENT_SPDIF_OUT 10 /* optical SPDIF output on */
101#else
100# define CURRENT_NORMAL 145 /* usual current in mA when using the AJB including some disk/backlight/... activity */ 102# define CURRENT_NORMAL 145 /* usual current in mA when using the AJB including some disk/backlight/... activity */
101# endif /* not IRIVER_H100_SERIES */ 103# define CURRENT_BACKLIGHT 30 /* additional current when backlight always on */
102# define CURRENT_USB 500 /* usual current in mA in USB mode */ 104#endif /* not IRIVER_H100_SERIES */
103# define CURRENT_BACKLIGHT 30 /* additional current when backlight is always on */ 105#define CURRENT_USB 500 /* usual current in mA in USB mode */
106#ifdef IRIVER_H100_SERIES
107# define CURRENT_RECORD 105 /* additional current while recording */
108#elif defined(IRIVER_H300_SERIES)
109# define CURRENT_RECORD 110
110#elif defined(HAVE_RECORDING)
111# define CURRENT_RECORD 35 /* FIXME: this needs adjusting */
112#endif
113#ifdef HAVE_REMOTE_LCD
114# define CURRENT_REMOTE 8 /* add. current when H100-remote connected */
115#endif
104 116
105# define CURRENT_MIN_CHG 70 /* minimum charge current */ 117# define CURRENT_MIN_CHG 70 /* minimum charge current */
106# define MIN_CHG_V 8500 /* at 8.5v charger voltage get CURRENT_MIN_CHG */ 118# define MIN_CHG_V 8500 /* at 8.5v charger voltage get CURRENT_MIN_CHG */
@@ -112,7 +124,6 @@ extern charger_input_state_type charger_input_state;
112# define MAX_CHG_V 10250 /* anything over 10.25v gives CURRENT_MAX_CHG */ 124# define MAX_CHG_V 10250 /* anything over 10.25v gives CURRENT_MAX_CHG */
113#endif /* not HAVE_MMC */ 125#endif /* not HAVE_MMC */
114 126
115extern unsigned int bat; /* filtered battery voltage, centivolts */
116extern unsigned short power_history[POWER_HISTORY_LEN]; 127extern unsigned short power_history[POWER_HISTORY_LEN];
117 128
118/* Start up power management thread */ 129/* Start up power management thread */
@@ -120,10 +131,10 @@ void powermgmt_init(void);
120 131
121#endif /* SIMULATOR */ 132#endif /* SIMULATOR */
122 133
123/* Returns battery level in percent */ 134/* Returns battery statust */
124int battery_level(void); 135int battery_level(void); /* percent */
125int battery_time(void); /* minutes */ 136int battery_time(void); /* minutes */
126 137int battery_adc_voltage(void); /* voltage from ADC in centivolts */
127unsigned int battery_voltage(void); /* filtered batt. voltage in centivolts */ 138unsigned int battery_voltage(void); /* filtered batt. voltage in centivolts */
128 139
129/* read unfiltered battery info */ 140/* read unfiltered battery info */
@@ -132,6 +143,9 @@ void battery_read_info(int *adc, int *voltage, int *level);
132/* Tells if the battery level is safe for disk writes */ 143/* Tells if the battery level is safe for disk writes */
133bool battery_level_safe(void); 144bool battery_level_safe(void);
134 145
146/* Tells if battery is in critical power saving state */
147bool battery_level_critical(void);
148
135void set_poweroff_timeout(int timeout); 149void set_poweroff_timeout(int timeout);
136void set_battery_capacity(int capacity); /* set local battery capacity value */ 150void set_battery_capacity(int capacity); /* set local battery capacity value */
137void set_battery_type(int type); /* set local battery type */ 151void set_battery_type(int type); /* set local battery type */