diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-04-14 06:52:38 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-04-14 06:52:38 +0000 |
commit | 0257547d58ce05db0331d7b541f07ce020a7649e (patch) | |
tree | 8de7d722df1d44d380782ea8f24feef23846885a /firmware/target/arm/imx31/gigabeat-s/powermgmt-imx31.c | |
parent | 25ebc858428b123aa03e816fe15e02991c91c4f6 (diff) | |
download | rockbox-0257547d58ce05db0331d7b541f07ce020a7649e.tar.gz rockbox-0257547d58ce05db0331d7b541f07ce020a7649e.zip |
Gigabeat S: Make ADC battery voltage reading correct. Tiny tweak to ADC driver traffic limiting.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17105 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/powermgmt-imx31.c')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/powermgmt-imx31.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/powermgmt-imx31.c b/firmware/target/arm/imx31/gigabeat-s/powermgmt-imx31.c index 7441100a7d..53996f8cd7 100644 --- a/firmware/target/arm/imx31/gigabeat-s/powermgmt-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/powermgmt-imx31.c | |||
@@ -48,13 +48,10 @@ const unsigned short percent_to_volt_charge[11] = | |||
48 | 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 | 48 | 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 |
49 | }; | 49 | }; |
50 | 50 | ||
51 | /* ADC[0] is (530) at discharge and 625 at full charge */ | ||
52 | #define BATTERY_SCALE_FACTOR 6605 | ||
53 | /* full-scale ADC readout (2^10) in millivolt */ | ||
54 | |||
55 | /* Returns battery voltage from ADC [millivolts] */ | 51 | /* Returns battery voltage from ADC [millivolts] */ |
56 | unsigned int battery_adc_voltage(void) | 52 | unsigned int battery_adc_voltage(void) |
57 | { | 53 | { |
58 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | 54 | /* ADC reading 0-1023 = 2400mV-4700mV */ |
55 | return ((adc_read(ADC_BATTERY) * 2303) >> 10) + 2400; | ||
59 | } | 56 | } |
60 | 57 | ||