summaryrefslogtreecommitdiff
path: root/firmware/target/arm/iriver/h10/powermgmt-h10.c
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2007-10-16 10:48:16 +0000
committerBarry Wardell <rockbox@barrywardell.net>2007-10-16 10:48:16 +0000
commit1d1a17c0dbd0fdf2857c5d1636713247d28f1762 (patch)
tree863d40550a3f6da5406d65471b3593bde9f9d8d5 /firmware/target/arm/iriver/h10/powermgmt-h10.c
parent8b44601a7c306611b9aba29a7774708585c97539 (diff)
downloadrockbox-1d1a17c0dbd0fdf2857c5d1636713247d28f1762.tar.gz
rockbox-1d1a17c0dbd0fdf2857c5d1636713247d28f1762.zip
Improved H10 ADC driver. We now do things exactly as the OF does. This includes shifting the readings by 0x14 when PLL is enabled. Battery voltages and remote/scrollpad values adjusted accordingly. We also now wait for the ADC to indicate the conversion is complete before reading the data, so hopefully we will get more reliably steady readings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15141 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/iriver/h10/powermgmt-h10.c')
-rw-r--r--firmware/target/arm/iriver/h10/powermgmt-h10.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/firmware/target/arm/iriver/h10/powermgmt-h10.c b/firmware/target/arm/iriver/h10/powermgmt-h10.c
index 18e3879c43..6f8cd12276 100644
--- a/firmware/target/arm/iriver/h10/powermgmt-h10.c
+++ b/firmware/target/arm/iriver/h10/powermgmt-h10.c
@@ -25,18 +25,18 @@
25const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 25const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
26{ 26{
27#ifdef IRIVER_H10 27#ifdef IRIVER_H10
28 3760 28 3733
29#elif defined IRIVER_H10_5GB 29#elif defined IRIVER_H10_5GB
30 3720 30 3695
31#endif 31#endif
32}; 32};
33 33
34const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = 34const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
35{ 35{
36#ifdef IRIVER_H10 36#ifdef IRIVER_H10
37 3650 37 3627
38#elif defined IRIVER_H10_5GB 38#elif defined IRIVER_H10_5GB
39 3650 39 3627
40#endif 40#endif
41}; 41};
42 42
@@ -44,9 +44,9 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
44const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 44const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
45{ 45{
46#ifdef IRIVER_H10 46#ifdef IRIVER_H10
47 { 3760, 3800, 3850, 3870, 3900, 3950, 4020, 4070, 4110, 4180, 4240 } 47 { 3733, 3772, 3821, 3840, 3869, 3917, 3985, 4034, 4072, 4140, 4198 }
48#elif defined IRIVER_H10_5GB 48#elif defined IRIVER_H10_5GB
49 { 3720, 3740, 3800, 3820, 3840, 3880, 3940, 4020, 4060, 4150, 4240 } 49 { 3695, 3714, 3772, 3791, 3811, 3850, 3908, 3985, 4024, 4111, 4198 }
50#endif 50#endif
51}; 51};
52 52
@@ -54,14 +54,14 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
54const unsigned short percent_to_volt_charge[11] = 54const unsigned short percent_to_volt_charge[11] =
55{ 55{
56#ifdef IRIVER_H10 56#ifdef IRIVER_H10
57 3990, 4030, 4060, 4080, 4100, 4120, 4150, 4180, 4220, 4260, 4310 57 3956, 3995, 4024, 4043, 4063, 4082, 4111, 4140, 4179, 4218, 4266
58#elif defined IRIVER_H10_5GB 58#elif defined IRIVER_H10_5GB
59 /* TODO: Not yet calibrated */ 59 /* TODO: Not yet calibrated */
60 3880, 3920, 3960, 4000, 4060, 4100, 4150, 4190, 4240, 4280, 4330 60 3850, 3888, 3927, 3966, 4024, 4063, 4111, 4150, 4198, 4237, 4286
61#endif 61#endif
62}; 62};
63 63
64#define BATTERY_SCALE_FACTOR 4800 64#define BATTERY_SCALE_FACTOR 4650
65/* full-scale ADC readout (2^10) in millivolt */ 65/* full-scale ADC readout (2^10) in millivolt */
66 66
67/* Returns battery voltage from ADC [millivolts] */ 67/* Returns battery voltage from ADC [millivolts] */