summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2012-01-03 23:44:38 +0000
committerThomas Martitz <kugel@rockbox.org>2012-01-03 23:44:38 +0000
commitc1bd9b0361ba92c29ceef68d74093e70a1a3e481 (patch)
tree1a42acdf2099b7f5ac06eee11e1d488b388c6d9f /firmware/export
parent949e6398c89e3c277a4c542f67a5ee788c6f642d (diff)
Rework powermgmt to enable code re-use on appliation and sims.
* Introduce CONFIG_BATTERY_MEASURE define, to allow targets (application) to break powermgmt.c's assumption about the ability to read battery voltage. There's now additionally percentage (android) and remaining time measure (maemo). No measure at all also works (sdl app). If voltage can't be measured, then battery_level() is king and it'll be used for power_history and runtime estimation. * Implement target's API in the simulator, i.e. _battery_voltage(), so it doesn't need to implement it's own powermgmt.c and other stubs. Now the sim behaves much more like a native target, although it still changes the simulated battery voltage quickly, * Other changes include include renaming battery_adc_voltage() to _battery_voltage(), for consistency with the new target functions and making some of the apps code aware that voltage and runtime estimation is not always available. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31548 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config.h18
-rw-r--r--firmware/export/config/android.h6
-rw-r--r--firmware/export/config/archosfmrecorder.h2
-rw-r--r--firmware/export/config/archosondiofm.h2
-rw-r--r--firmware/export/config/archosondiosp.h2
-rw-r--r--firmware/export/config/archosplayer.h2
-rw-r--r--firmware/export/config/archosrecorder.h2
-rw-r--r--firmware/export/config/archosrecorderv2.h2
-rw-r--r--firmware/export/config/cowond2.h2
-rw-r--r--firmware/export/config/creativezv.h2
-rw-r--r--firmware/export/config/gigabeatfx.h2
-rw-r--r--firmware/export/config/gigabeats.h2
-rw-r--r--firmware/export/config/gogearhdd1630.h2
-rw-r--r--firmware/export/config/gogearhdd6330.h2
-rw-r--r--firmware/export/config/gogearsa9200.h2
-rw-r--r--firmware/export/config/hifimanhm60x.h2
-rw-r--r--firmware/export/config/hifimanhm801.h2
-rw-r--r--firmware/export/config/iaudio7.h2
-rw-r--r--firmware/export/config/iaudiom3.h2
-rw-r--r--firmware/export/config/iaudiom5.h2
-rw-r--r--firmware/export/config/iaudiox5.h2
-rw-r--r--firmware/export/config/ipod1g2g.h2
-rw-r--r--firmware/export/config/ipod3g.h2
-rw-r--r--firmware/export/config/ipod4g.h2
-rw-r--r--firmware/export/config/ipod6g.h2
-rw-r--r--firmware/export/config/ipodcolor.h2
-rw-r--r--firmware/export/config/ipodmini1g.h2
-rw-r--r--firmware/export/config/ipodmini2g.h2
-rw-r--r--firmware/export/config/ipodnano1g.h2
-rw-r--r--firmware/export/config/ipodnano2g.h2
-rw-r--r--firmware/export/config/ipodvideo.h2
-rw-r--r--firmware/export/config/iriverh10.h2
-rw-r--r--firmware/export/config/iriverh100.h2
-rw-r--r--firmware/export/config/iriverh10_5gb.h2
-rw-r--r--firmware/export/config/iriverh120.h2
-rw-r--r--firmware/export/config/iriverh300.h2
-rw-r--r--firmware/export/config/iriverifp7xx.h2
-rw-r--r--firmware/export/config/logikdax.h2
-rw-r--r--firmware/export/config/lyreproto1.h2
-rw-r--r--firmware/export/config/meizum3.h2
-rw-r--r--firmware/export/config/meizum6sl.h2
-rw-r--r--firmware/export/config/meizum6sp.h2
-rw-r--r--firmware/export/config/mini2440.h2
-rw-r--r--firmware/export/config/mpiohd200.h2
-rw-r--r--firmware/export/config/mpiohd300.h2
-rw-r--r--firmware/export/config/mrobe100.h2
-rw-r--r--firmware/export/config/mrobe500.h2
-rw-r--r--firmware/export/config/nokian8xx.h9
-rw-r--r--firmware/export/config/nokian900.h11
-rw-r--r--firmware/export/config/ondavx747.h2
-rw-r--r--firmware/export/config/ondavx767.h2
-rw-r--r--firmware/export/config/ondavx777.h2
-rw-r--r--firmware/export/config/rk27generic.h2
-rw-r--r--firmware/export/config/samsungyh820.h2
-rw-r--r--firmware/export/config/samsungyh920.h2
-rw-r--r--firmware/export/config/samsungyh925.h2
-rw-r--r--firmware/export/config/samsungypr0.h2
-rw-r--r--firmware/export/config/samsungyps3.h2
-rw-r--r--firmware/export/config/sansac100.h2
-rw-r--r--firmware/export/config/sansac200.h2
-rw-r--r--firmware/export/config/sansac200v2.h2
-rw-r--r--firmware/export/config/sansaclip.h2
-rw-r--r--firmware/export/config/sansaclipplus.h2
-rw-r--r--firmware/export/config/sansaclipv2.h2
-rw-r--r--firmware/export/config/sansaclipzip.h2
-rw-r--r--firmware/export/config/sansaconnect.h2
-rw-r--r--firmware/export/config/sansae200.h2
-rw-r--r--firmware/export/config/sansae200v2.h2
-rw-r--r--firmware/export/config/sansafuze.h2
-rw-r--r--firmware/export/config/sansafuzeplus.h2
-rw-r--r--firmware/export/config/sansafuzev2.h2
-rw-r--r--firmware/export/config/sansam200.h2
-rw-r--r--firmware/export/config/sansam200v4.h2
-rw-r--r--firmware/export/config/sansaview.h2
-rw-r--r--firmware/export/config/sdlapp.h5
-rw-r--r--firmware/export/config/sim.h5
-rw-r--r--firmware/export/config/tatungtpj1022.h2
-rw-r--r--firmware/export/config/vibe500.h2
-rw-r--r--firmware/export/config/zenvisionm30gb.h2
-rw-r--r--firmware/export/config/zenvisionm60gb.h2
-rw-r--r--firmware/export/power.h3
-rw-r--r--firmware/export/powermgmt.h17
82 files changed, 191 insertions, 31 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h
index f5bc7788d7..85c83015bd 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -184,6 +184,15 @@
* charging or specific programming is required to
* use the charging hardware. */
+/* CONFIG_BATTERY_MEASURE bits */
+#define VOLTAGE_MEASURE 1 /* Target can report battery voltage
+ * Usually native ports */
+#define PERCENTAGE_MEASURE 2 /* Target can report remaining capacity in %
+ * Usually application/hosted ports */
+#define TIME_MEASURE 4 /* Target can report remaining time estimation
+ Usually application ports, and only
+ if the estimation is better that ours
+ (which it probably is) */
/* CONFIG_LCD */
#define LCD_SSD1815 1 /* as used by Archos Recorders and Ondios */
#define LCD_SSD1801 2 /* as used by Archos Player/Studio */
@@ -603,6 +612,11 @@ Lyre prototype 1 */
#define CONFIG_CHARGING 0
#endif
+#ifndef CONFIG_BATTERY_MEASURE
+#define CONFIG_BATTERY_MEASURE 0
+#define NO_LOW_BATTERY_SHUTDOWN
+#endif
+
#ifndef CONFIG_RTC
#define CONFIG_RTC 0
#endif
@@ -611,6 +625,10 @@ Lyre prototype 1 */
#define BATTERY_TYPES_COUNT 0
#endif
+#ifndef BATTERY_CAPACITY_DEFAULT
+#define BATTERY_CAPACITY_DEFAULT 0
+#endif
+
#ifndef BATTERY_CAPACITY_INC
#define BATTERY_CAPACITY_INC 0
#endif
diff --git a/firmware/export/config/android.h b/firmware/export/config/android.h
index 41ecacfb9d..6261a80b06 100644
--- a/firmware/export/config/android.h
+++ b/firmware/export/config/android.h
@@ -86,11 +86,9 @@
#define HAVE_HEADPHONE_DETECTION
-/* Define current usage levels. */
-#define CURRENT_NORMAL 88 /* 18 hours from a 1600 mAh battery */
-#define CURRENT_BACKLIGHT 30 /* TBD */
-#define CURRENT_RECORD 0 /* no recording yet */
+#define CONFIG_BATTERY_MEASURE PERCENTAGE_MEASURE
+#define NO_LOW_BATTERY_SHUTDOWN
/* Define this to the CPU frequency */
/*
#define CPU_FREQ 48000000
diff --git a/firmware/export/config/archosfmrecorder.h b/firmware/export/config/archosfmrecorder.h
index 3e2c7e932e..6b1f07f752 100644
--- a/firmware/export/config/archosfmrecorder.h
+++ b/firmware/export/config/archosfmrecorder.h
@@ -91,6 +91,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
#define CURRENT_NORMAL 145 /* usual current in mA */
#define CURRENT_RECORD 35 /* additional recording current */
#define CURRENT_USB 500 /* usual current in mA in USB mode */
diff --git a/firmware/export/config/archosondiofm.h b/firmware/export/config/archosondiofm.h
index 516845e49d..1a1115f318 100644
--- a/firmware/export/config/archosondiofm.h
+++ b/firmware/export/config/archosondiofm.h
@@ -73,6 +73,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define this if the unit should not shut down on low battery. */
#define NO_LOW_BATTERY_SHUTDOWN
diff --git a/firmware/export/config/archosondiosp.h b/firmware/export/config/archosondiosp.h
index ba957f7f44..aad66b7f45 100644
--- a/firmware/export/config/archosondiosp.h
+++ b/firmware/export/config/archosondiosp.h
@@ -60,6 +60,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define this if the unit should not shut down on low battery. */
#define NO_LOW_BATTERY_SHUTDOWN
diff --git a/firmware/export/config/archosplayer.h b/firmware/export/config/archosplayer.h
index bc75433950..af125571ba 100644
--- a/firmware/export/config/archosplayer.h
+++ b/firmware/export/config/archosplayer.h
@@ -49,6 +49,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
#define CURRENT_NORMAL 145 /* usual current in mA */
#define CURRENT_USB 500 /* usual current in mA in USB mode */
diff --git a/firmware/export/config/archosrecorder.h b/firmware/export/config/archosrecorder.h
index be7c872b0e..6c708fb450 100644
--- a/firmware/export/config/archosrecorder.h
+++ b/firmware/export/config/archosrecorder.h
@@ -80,6 +80,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
#if MEMORYSIZE < 8
#define CURRENT_NORMAL 145 /* usual current in mA */
#else
diff --git a/firmware/export/config/archosrecorderv2.h b/firmware/export/config/archosrecorderv2.h
index e2f3b66a82..dae34ef226 100644
--- a/firmware/export/config/archosrecorderv2.h
+++ b/firmware/export/config/archosrecorderv2.h
@@ -86,6 +86,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
#define CURRENT_NORMAL 145 /* usual current in mA */
#define CURRENT_RECORD 35 /* additional recording current */
#define CURRENT_USB 500 /* usual current in mA in USB mode */
diff --git a/firmware/export/config/cowond2.h b/firmware/export/config/cowond2.h
index ebaa636ac7..03fbb4fbb8 100644
--- a/firmware/export/config/cowond2.h
+++ b/firmware/export/config/cowond2.h
@@ -136,6 +136,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/creativezv.h b/firmware/export/config/creativezv.h
index 0fd216aae6..568144b698 100644
--- a/firmware/export/config/creativezv.h
+++ b/firmware/export/config/creativezv.h
@@ -130,6 +130,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
//#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/gigabeatfx.h b/firmware/export/config/gigabeatfx.h
index b64f3f5b3b..fbaa4a0f31 100644
--- a/firmware/export/config/gigabeatfx.h
+++ b/firmware/export/config/gigabeatfx.h
@@ -129,6 +129,8 @@
#define BATTERY_CAPACITY_INC 25 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/gigabeats.h b/firmware/export/config/gigabeats.h
index 685076bfa3..f7fdc449c4 100644
--- a/firmware/export/config/gigabeats.h
+++ b/firmware/export/config/gigabeats.h
@@ -173,6 +173,8 @@
#define BATTERY_CAPACITY_INC 25 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* TODO: have a proper status displayed in the bootloader and have it
* work! */
/* Charging implemented in a target-specific algorithm */
diff --git a/firmware/export/config/gogearhdd1630.h b/firmware/export/config/gogearhdd1630.h
index e9bbfb872a..05f1a472a6 100644
--- a/firmware/export/config/gogearhdd1630.h
+++ b/firmware/export/config/gogearhdd1630.h
@@ -141,6 +141,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/gogearhdd6330.h b/firmware/export/config/gogearhdd6330.h
index fc326dac89..b8ee918da1 100644
--- a/firmware/export/config/gogearhdd6330.h
+++ b/firmware/export/config/gogearhdd6330.h
@@ -144,6 +144,8 @@
#define BATTERY_CAPACITY_INC 20 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/gogearsa9200.h b/firmware/export/config/gogearsa9200.h
index b91430e6de..e29c8dcddc 100644
--- a/firmware/export/config/gogearsa9200.h
+++ b/firmware/export/config/gogearsa9200.h
@@ -125,6 +125,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/export/config/hifimanhm60x.h b/firmware/export/config/hifimanhm60x.h
index 6ac43803f3..bdc6124833 100644
--- a/firmware/export/config/hifimanhm60x.h
+++ b/firmware/export/config/hifimanhm60x.h
@@ -130,6 +130,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/hifimanhm801.h b/firmware/export/config/hifimanhm801.h
index 469c423a27..a5b5aeead8 100644
--- a/firmware/export/config/hifimanhm801.h
+++ b/firmware/export/config/hifimanhm801.h
@@ -118,6 +118,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/iaudio7.h b/firmware/export/config/iaudio7.h
index 8a04bc06c2..0664ff00ed 100644
--- a/firmware/export/config/iaudio7.h
+++ b/firmware/export/config/iaudio7.h
@@ -131,6 +131,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
#define CONFIG_CHARGING CHARGING_SIMPLE
/* Define this if you have a TCC770 */
diff --git a/firmware/export/config/iaudiom3.h b/firmware/export/config/iaudiom3.h
index 6fdf11ca77..d2f90641db 100644
--- a/firmware/export/config/iaudiom3.h
+++ b/firmware/export/config/iaudiom3.h
@@ -114,6 +114,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? FIXME */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/iaudiom5.h b/firmware/export/config/iaudiom5.h
index ad86308667..0bc3ed5630 100644
--- a/firmware/export/config/iaudiom5.h
+++ b/firmware/export/config/iaudiom5.h
@@ -138,6 +138,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? FIXME */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/iaudiox5.h b/firmware/export/config/iaudiox5.h
index 2083095c2b..b88583c4b1 100644
--- a/firmware/export/config/iaudiox5.h
+++ b/firmware/export/config/iaudiox5.h
@@ -141,6 +141,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? FIXME */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/ipod1g2g.h b/firmware/export/config/ipod1g2g.h
index 0ce5d45590..b2b1f4a498 100644
--- a/firmware/export/config/ipod1g2g.h
+++ b/firmware/export/config/ipod1g2g.h
@@ -130,6 +130,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? FIXME */
//#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/ipod3g.h b/firmware/export/config/ipod3g.h
index e7d8bff53b..16bd1072b4 100644
--- a/firmware/export/config/ipod3g.h
+++ b/firmware/export/config/ipod3g.h
@@ -137,6 +137,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? FIXME */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/ipod4g.h b/firmware/export/config/ipod4g.h
index 957e3a4da5..5ddde1b186 100644
--- a/firmware/export/config/ipod4g.h
+++ b/firmware/export/config/ipod4g.h
@@ -143,6 +143,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/ipod6g.h b/firmware/export/config/ipod6g.h
index 95837cce12..08c0f27ef0 100644
--- a/firmware/export/config/ipod6g.h
+++ b/firmware/export/config/ipod6g.h
@@ -145,6 +145,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/ipodcolor.h b/firmware/export/config/ipodcolor.h
index cf021019b4..9768ac38aa 100644
--- a/firmware/export/config/ipodcolor.h
+++ b/firmware/export/config/ipodcolor.h
@@ -130,6 +130,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/ipodmini1g.h b/firmware/export/config/ipodmini1g.h
index 04fa68e500..b1f6fa1b1a 100644
--- a/firmware/export/config/ipodmini1g.h
+++ b/firmware/export/config/ipodmini1g.h
@@ -141,6 +141,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define current usage levels */
#define CURRENT_NORMAL 50 /* PP5024 uses ~40mA, so add some for disk */
#define CURRENT_BACKLIGHT 20 /* FIXME: This needs to be measured */
diff --git a/firmware/export/config/ipodmini2g.h b/firmware/export/config/ipodmini2g.h
index c10284e7a4..27edf100ae 100644
--- a/firmware/export/config/ipodmini2g.h
+++ b/firmware/export/config/ipodmini2g.h
@@ -142,6 +142,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define current usage levels */
#define CURRENT_NORMAL 50 /* PP5024 uses ~40mA, so add some for disk */
#define CURRENT_BACKLIGHT 20 /* FIXME: This needs to be measured */
diff --git a/firmware/export/config/ipodnano1g.h b/firmware/export/config/ipodnano1g.h
index 50f0511384..40f6cf28aa 100644
--- a/firmware/export/config/ipodnano1g.h
+++ b/firmware/export/config/ipodnano1g.h
@@ -134,6 +134,8 @@
#define BATTERY_CAPACITY_INC 20 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/ipodnano2g.h b/firmware/export/config/ipodnano2g.h
index e0941e03b0..2e4f189d31 100644
--- a/firmware/export/config/ipodnano2g.h
+++ b/firmware/export/config/ipodnano2g.h
@@ -148,6 +148,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/ipodvideo.h b/firmware/export/config/ipodvideo.h
index c4e2cb2986..7e123d08d7 100644
--- a/firmware/export/config/ipodvideo.h
+++ b/firmware/export/config/ipodvideo.h
@@ -149,6 +149,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/iriverh10.h b/firmware/export/config/iriverh10.h
index d2d7a0cb7a..3611093913 100644
--- a/firmware/export/config/iriverh10.h
+++ b/firmware/export/config/iriverh10.h
@@ -127,6 +127,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/iriverh100.h b/firmware/export/config/iriverh100.h
index 1a89c7ca2d..644726541f 100644
--- a/firmware/export/config/iriverh100.h
+++ b/firmware/export/config/iriverh100.h
@@ -131,6 +131,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/iriverh10_5gb.h b/firmware/export/config/iriverh10_5gb.h
index 0ad83cb85d..84c0b370ab 100644
--- a/firmware/export/config/iriverh10_5gb.h
+++ b/firmware/export/config/iriverh10_5gb.h
@@ -110,6 +110,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/iriverh120.h b/firmware/export/config/iriverh120.h
index 199b948245..5bab810df2 100644
--- a/firmware/export/config/iriverh120.h
+++ b/firmware/export/config/iriverh120.h
@@ -135,6 +135,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/iriverh300.h b/firmware/export/config/iriverh300.h
index dbe701362a..4250153c04 100644
--- a/firmware/export/config/iriverh300.h
+++ b/firmware/export/config/iriverh300.h
@@ -130,6 +130,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/iriverifp7xx.h b/firmware/export/config/iriverifp7xx.h
index 78c0783d27..1de6adc25a 100644
--- a/firmware/export/config/iriverifp7xx.h
+++ b/firmware/export/config/iriverifp7xx.h
@@ -70,6 +70,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define this if the unit should not shut down on low battery. */
#define NO_LOW_BATTERY_SHUTDOWN
diff --git a/firmware/export/config/logikdax.h b/firmware/export/config/logikdax.h
index 45f5651a43..ed6cbba531 100644
--- a/firmware/export/config/logikdax.h
+++ b/firmware/export/config/logikdax.h
@@ -102,6 +102,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define this if the unit should not shut down on low battery. */
#define NO_LOW_BATTERY_SHUTDOWN
diff --git a/firmware/export/config/lyreproto1.h b/firmware/export/config/lyreproto1.h
index 1413adc7e3..95808cf2f5 100644
--- a/firmware/export/config/lyreproto1.h
+++ b/firmware/export/config/lyreproto1.h
@@ -84,6 +84,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
#define CONFIG_CPU AT91SAM9260
/* Define this to the CPU frequency */
diff --git a/firmware/export/config/meizum3.h b/firmware/export/config/meizum3.h
index 7cba1c7e7f..d1a2b8f34a 100644
--- a/firmware/export/config/meizum3.h
+++ b/firmware/export/config/meizum3.h
@@ -119,6 +119,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging, software can monitor plug and charge state */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/meizum6sl.h b/firmware/export/config/meizum6sl.h
index 28c0fc0286..e0e5e9d43c 100644
--- a/firmware/export/config/meizum6sl.h
+++ b/firmware/export/config/meizum6sl.h
@@ -119,6 +119,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? FIXME */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/meizum6sp.h b/firmware/export/config/meizum6sp.h
index f88be0420c..34d7c92480 100644
--- a/firmware/export/config/meizum6sp.h
+++ b/firmware/export/config/meizum6sp.h
@@ -125,6 +125,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? FIXME */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/mini2440.h b/firmware/export/config/mini2440.h
index 4b4a137110..9b794ecb0a 100644
--- a/firmware/export/config/mini2440.h
+++ b/firmware/export/config/mini2440.h
@@ -95,6 +95,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/***************************************************************************/
diff --git a/firmware/export/config/mpiohd200.h b/firmware/export/config/mpiohd200.h
index f85b9a28fd..13691722f9 100644
--- a/firmware/export/config/mpiohd200.h
+++ b/firmware/export/config/mpiohd200.h
@@ -116,6 +116,8 @@
#define CODEC_SRCTRL_88200HZ (0x1E << 1)
#define BATTERY_TYPES_COUNT 1
+
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
#define BATTERY_CAPACITY_DEFAULT 850 /* this is wild guess */
#define BATTERY_CAPACITY_MIN 800 /* min. capacity selectable */
#define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */
diff --git a/firmware/export/config/mpiohd300.h b/firmware/export/config/mpiohd300.h
index 6728d5cccb..8343a90938 100644
--- a/firmware/export/config/mpiohd300.h
+++ b/firmware/export/config/mpiohd300.h
@@ -119,6 +119,8 @@
#define CODEC_SRCTRL_88200HZ (0x1E << 1)
#define BATTERY_TYPES_COUNT 1
+
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
#define BATTERY_CAPACITY_DEFAULT 1200 /* this is wild guess */
#define BATTERY_CAPACITY_MIN 800 /* min. capacity selectable */
#define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */
diff --git a/firmware/export/config/mrobe100.h b/firmware/export/config/mrobe100.h
index 1b373a9799..510475d0f4 100644
--- a/firmware/export/config/mrobe100.h
+++ b/firmware/export/config/mrobe100.h
@@ -142,6 +142,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/mrobe500.h b/firmware/export/config/mrobe500.h
index 590f8a95f9..6f8bc6c568 100644
--- a/firmware/export/config/mrobe500.h
+++ b/firmware/export/config/mrobe500.h
@@ -197,6 +197,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define current usage levels */
#define CURRENT_NORMAL 85 /* Measured */
#define CURRENT_BACKLIGHT 200 /* Over 200 mA total measured when on */
diff --git a/firmware/export/config/nokian8xx.h b/firmware/export/config/nokian8xx.h
index f11fa87021..55f96f76c3 100644
--- a/firmware/export/config/nokian8xx.h
+++ b/firmware/export/config/nokian8xx.h
@@ -74,12 +74,11 @@
#define HAVE_SDL
#define HAVE_SDL_AUDIO
-#define HAVE_SW_TONE_CONTROLS
+#define HAVE_SW_TONE_CONTROLS
-/* Define current usage levels. */
-#define CURRENT_NORMAL 88 /* 18 hours from a 1600 mAh battery */
-#define CURRENT_BACKLIGHT 30 /* TBD */
-#define CURRENT_RECORD 0 /* no recording yet */
+/* can provide both remaining percentage and time information */
+#define CONFIG_BATTERY_MEASURE (PERCENTAGE_MEASURE|TIME_MEASURE)
+#define NO_LOW_BATTERY_SHUTDOWN
/* Define this to the CPU frequency */
/*
diff --git a/firmware/export/config/nokian900.h b/firmware/export/config/nokian900.h
index a36aebf8db..1e74fd527e 100644
--- a/firmware/export/config/nokian900.h
+++ b/firmware/export/config/nokian900.h
@@ -74,14 +74,11 @@
#define HAVE_SDL
#define HAVE_SDL_AUDIO
-#define HAVE_SW_TONE_CONTROLS
+#define HAVE_SW_TONE_CONTROLS
-/* Define current usage levels. */
-#define CURRENT_NORMAL 88 /* 18 hours from a 1600 mAh battery */
-#define CURRENT_BACKLIGHT 30 /* TBD */
-#define CURRENT_RECORD 0 /* no recording yet */
-
-/* Define this to the CPU frequency */
+/* can provide both remaining percentage and time information */
+#define CONFIG_BATTERY_MEASURE (PERCENTAGE_MEASURE|TIME_MEASURE)
+#define NO_LOW_BATTERY_SHUTDOWN
/*
#define CPU_FREQ 48000000
*/
diff --git a/firmware/export/config/ondavx747.h b/firmware/export/config/ondavx747.h
index e01c6ccc46..45aec00bb8 100644
--- a/firmware/export/config/ondavx747.h
+++ b/firmware/export/config/ondavx747.h
@@ -157,6 +157,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/ondavx767.h b/firmware/export/config/ondavx767.h
index b2bac4f851..44a7aa0229 100644
--- a/firmware/export/config/ondavx767.h
+++ b/firmware/export/config/ondavx767.h
@@ -132,6 +132,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
//#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/ondavx777.h b/firmware/export/config/ondavx777.h
index b9167e04ae..0319816d26 100644
--- a/firmware/export/config/ondavx777.h
+++ b/firmware/export/config/ondavx777.h
@@ -151,6 +151,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/rk27generic.h b/firmware/export/config/rk27generic.h
index d7b63f0ac2..6cebb8ce2a 100644
--- a/firmware/export/config/rk27generic.h
+++ b/firmware/export/config/rk27generic.h
@@ -136,6 +136,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/samsungyh820.h b/firmware/export/config/samsungyh820.h
index d7d54112f0..74cd05209e 100644
--- a/firmware/export/config/samsungyh820.h
+++ b/firmware/export/config/samsungyh820.h
@@ -134,6 +134,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/samsungyh920.h b/firmware/export/config/samsungyh920.h
index 5255a05359..73f226d6c9 100644
--- a/firmware/export/config/samsungyh920.h
+++ b/firmware/export/config/samsungyh920.h
@@ -141,6 +141,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/samsungyh925.h b/firmware/export/config/samsungyh925.h
index 3e072ddb86..c95d1e50d1 100644
--- a/firmware/export/config/samsungyh925.h
+++ b/firmware/export/config/samsungyh925.h
@@ -138,6 +138,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h
index 2de36dcb74..735db1fcad 100644
--- a/firmware/export/config/samsungypr0.h
+++ b/firmware/export/config/samsungypr0.h
@@ -132,6 +132,8 @@
#define CURRENT_NORMAL 24 /* ~25h, on 600mAh that's about 24mA */
#define CURRENT_BACKLIGHT 62 /* ~6,5h -> 92mA. Minus 24mA normal that gives us 68mA */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Linux controlls charging, we can monitor */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/samsungyps3.h b/firmware/export/config/samsungyps3.h
index 3062d5c58e..cef3b60207 100644
--- a/firmware/export/config/samsungyps3.h
+++ b/firmware/export/config/samsungyps3.h
@@ -118,6 +118,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging, software can monitor plug and charge state */
#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/sansac100.h b/firmware/export/config/sansac100.h
index e61e42639c..5aabfc284c 100644
--- a/firmware/export/config/sansac100.h
+++ b/firmware/export/config/sansac100.h
@@ -92,6 +92,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define this if the unit should not shut down on low battery. */
#define NO_LOW_BATTERY_SHUTDOWN
diff --git a/firmware/export/config/sansac200.h b/firmware/export/config/sansac200.h
index 74d3d94b78..479623f078 100644
--- a/firmware/export/config/sansac200.h
+++ b/firmware/export/config/sansac200.h
@@ -142,6 +142,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/export/config/sansac200v2.h b/firmware/export/config/sansac200v2.h
index a5b857fe81..742d66f20d 100644
--- a/firmware/export/config/sansac200v2.h
+++ b/firmware/export/config/sansac200v2.h
@@ -138,6 +138,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
diff --git a/firmware/export/config/sansaclip.h b/firmware/export/config/sansaclip.h
index 4e214669b1..617e661555 100644
--- a/firmware/export/config/sansaclip.h
+++ b/firmware/export/config/sansaclip.h
@@ -141,6 +141,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
diff --git a/firmware/export/config/sansaclipplus.h b/firmware/export/config/sansaclipplus.h
index 083b96a8f7..b753f585e2 100644
--- a/firmware/export/config/sansaclipplus.h
+++ b/firmware/export/config/sansaclipplus.h
@@ -148,6 +148,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
diff --git a/firmware/export/config/sansaclipv2.h b/firmware/export/config/sansaclipv2.h
index cb2392ac76..4358fe5507 100644
--- a/firmware/export/config/sansaclipv2.h
+++ b/firmware/export/config/sansaclipv2.h
@@ -144,6 +144,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
diff --git a/firmware/export/config/sansaclipzip.h b/firmware/export/config/sansaclipzip.h
index 043b1025fb..696125e963 100644
--- a/firmware/export/config/sansaclipzip.h
+++ b/firmware/export/config/sansaclipzip.h
@@ -149,6 +149,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
diff --git a/firmware/export/config/sansaconnect.h b/firmware/export/config/sansaconnect.h
index 714534d6ad..a0f517992b 100644
--- a/firmware/export/config/sansaconnect.h
+++ b/firmware/export/config/sansaconnect.h
@@ -149,6 +149,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define current usage levels */
#if 0
/* TODO */
diff --git a/firmware/export/config/sansae200.h b/firmware/export/config/sansae200.h
index dd5747a9ca..c5b53e6ea2 100644
--- a/firmware/export/config/sansae200.h
+++ b/firmware/export/config/sansae200.h
@@ -142,6 +142,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/export/config/sansae200v2.h b/firmware/export/config/sansae200v2.h
index a03dfe05a6..19346dbfb6 100644
--- a/firmware/export/config/sansae200v2.h
+++ b/firmware/export/config/sansae200v2.h
@@ -152,6 +152,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
diff --git a/firmware/export/config/sansafuze.h b/firmware/export/config/sansafuze.h
index 2e9c261a04..f905bc7862 100644
--- a/firmware/export/config/sansafuze.h
+++ b/firmware/export/config/sansafuze.h
@@ -156,6 +156,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
diff --git a/firmware/export/config/sansafuzeplus.h b/firmware/export/config/sansafuzeplus.h
index 880bbae458..1c8fdadb31 100644
--- a/firmware/export/config/sansafuzeplus.h
+++ b/firmware/export/config/sansafuzeplus.h
@@ -140,6 +140,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
diff --git a/firmware/export/config/sansafuzev2.h b/firmware/export/config/sansafuzev2.h
index 8231236104..ae25592d1a 100644
--- a/firmware/export/config/sansafuzev2.h
+++ b/firmware/export/config/sansafuzev2.h
@@ -161,6 +161,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
diff --git a/firmware/export/config/sansam200.h b/firmware/export/config/sansam200.h
index c5eade88e9..2c37f91a99 100644
--- a/firmware/export/config/sansam200.h
+++ b/firmware/export/config/sansam200.h
@@ -98,6 +98,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define this if the unit should not shut down on low battery. */
#define NO_LOW_BATTERY_SHUTDOWN
diff --git a/firmware/export/config/sansam200v4.h b/firmware/export/config/sansam200v4.h
index 7559361d4c..ef371e53dd 100644
--- a/firmware/export/config/sansam200v4.h
+++ b/firmware/export/config/sansam200v4.h
@@ -118,6 +118,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* define this if the unit should not shut down on low battery. */
#define NO_LOW_BATTERY_SHUTDOWN
diff --git a/firmware/export/config/sansaview.h b/firmware/export/config/sansaview.h
index 829f67ab3e..89da94338f 100644
--- a/firmware/export/config/sansaview.h
+++ b/firmware/export/config/sansaview.h
@@ -129,6 +129,8 @@
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_SIMPLE
#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/export/config/sdlapp.h b/firmware/export/config/sdlapp.h
index a55b7e3be3..ac43a0fb14 100644
--- a/firmware/export/config/sdlapp.h
+++ b/firmware/export/config/sdlapp.h
@@ -80,11 +80,6 @@
#define HAVE_SW_TONE_CONTROLS
-/* Define current usage levels. */
-#define CURRENT_NORMAL 88 /* 18 hours from a 1600 mAh battery */
-#define CURRENT_BACKLIGHT 30 /* TBD */
-#define CURRENT_RECORD 0 /* no recording yet */
-
/* Define this to the CPU frequency */
/*
#define CPU_FREQ 48000000
diff --git a/firmware/export/config/sim.h b/firmware/export/config/sim.h
index f0c9f47a2f..f565e6192e 100644
--- a/firmware/export/config/sim.h
+++ b/firmware/export/config/sim.h
@@ -36,6 +36,11 @@
#undef CONFIG_STORAGE
+#if defined(CONFIG_CHARGING) && CONFIG_CHARGING > CHARGING_MONITOR
+#undef CONFIG_CHARGING
+#define CONFIG_CHARGING CHARGING_MONITOR
+#endif
+
#undef CONFIG_USBOTG
#undef USB_HANDLED_BY_OF
diff --git a/firmware/export/config/tatungtpj1022.h b/firmware/export/config/tatungtpj1022.h
index 247ca4780b..15d5cf2456 100644
--- a/firmware/export/config/tatungtpj1022.h
+++ b/firmware/export/config/tatungtpj1022.h
@@ -85,6 +85,8 @@
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging? FIXME */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/vibe500.h b/firmware/export/config/vibe500.h
index ad2299061a..da53005c5c 100644
--- a/firmware/export/config/vibe500.h
+++ b/firmware/export/config/vibe500.h
@@ -126,6 +126,8 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging, software can monitor plug and charge state */
#define CONFIG_CHARGING CHARGING_SIMPLE
diff --git a/firmware/export/config/zenvisionm30gb.h b/firmware/export/config/zenvisionm30gb.h
index 335257d102..c6448132a7 100644
--- a/firmware/export/config/zenvisionm30gb.h
+++ b/firmware/export/config/zenvisionm30gb.h
@@ -131,6 +131,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
//#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/config/zenvisionm60gb.h b/firmware/export/config/zenvisionm60gb.h
index 62353089f8..321dd5d164 100644
--- a/firmware/export/config/zenvisionm60gb.h
+++ b/firmware/export/config/zenvisionm60gb.h
@@ -130,6 +130,8 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
+#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+
/* Hardware controlled charging with monitoring */
//#define CONFIG_CHARGING CHARGING_MONITOR
diff --git a/firmware/export/power.h b/firmware/export/power.h
index 2aea20c27e..d46b9ba924 100644
--- a/firmware/export/power.h
+++ b/firmware/export/power.h
@@ -23,7 +23,6 @@
#include "config.h"
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SAMSUNG_YPR0) || defined(SIMULATOR)
#if CONFIG_CHARGING
enum power_input_flags {
/* No external power source? Default. */
@@ -101,6 +100,4 @@ bool tuner_power(bool status);
bool tuner_powered(void);
#endif
-#endif
-
#endif /* _POWER_H_ */
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 837767f56b..9e9d3d0fd8 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -78,8 +78,6 @@ extern unsigned int power_thread_inputs;
/* Start up power management thread */
void powermgmt_init(void) INIT_ATTR;
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SAMSUNG_YPR0)
-
/* Generic current values that are intentionally meaningless - config header
* should define proper numbers.*/
@@ -130,13 +128,18 @@ extern const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11];
extern const unsigned short percent_to_volt_charge[11];
#endif
-#endif /* PLATFORM_NATIVE */
-
-/* Returns battery statust */
+/* Returns battery status, filtered for runtime estimation */
int battery_level(void); /* percent */
int battery_time(void); /* minutes */
-unsigned int battery_adc_voltage(void); /* voltage from ADC in millivolts */
-unsigned int battery_voltage(void); /* filtered batt. voltage in millivolts */
+int battery_voltage(void); /* filtered batt. voltage in millivolts */
+
+/* Implemented by the target, unfiltered */
+int _battery_level(void); /* percent */
+int _battery_time(void); /* minutes */
+int _battery_voltage(void); /* voltage in millivolts */
+#if CONFIG_CHARGING >= CHARGING_TARGET
+void powermgmt_init_target(void);
+#endif
#ifdef HAVE_BATTERY_SWITCH
unsigned int input_millivolts(void); /* voltage that device is running from */