diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-08-17 20:47:24 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-08-17 20:47:24 +0000 |
commit | bfa1adcd06eca3b64f6d71b2231db88cd86ef902 (patch) | |
tree | ee53b3a672aed7305e39e72c151928a83bce4e13 /firmware/target/coldfire/iriver/h300/powermgmt-h300.c | |
parent | 98a3789071caac4b7e64f1cc0f5969ecd530cc5c (diff) | |
download | rockbox-bfa1adcd06eca3b64f6d71b2231db88cd86ef902.tar.gz rockbox-bfa1adcd06eca3b64f6d71b2231db88cd86ef902.zip |
H300: Read battery voltage with 10bit precision.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14379 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iriver/h300/powermgmt-h300.c')
-rw-r--r-- | firmware/target/coldfire/iriver/h300/powermgmt-h300.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/target/coldfire/iriver/h300/powermgmt-h300.c b/firmware/target/coldfire/iriver/h300/powermgmt-h300.c index b2d844075e..1bf1de59d9 100644 --- a/firmware/target/coldfire/iriver/h300/powermgmt-h300.c +++ b/firmware/target/coldfire/iriver/h300/powermgmt-h300.c | |||
@@ -48,11 +48,11 @@ const unsigned short percent_to_volt_charge[11] = | |||
48 | 48 | ||
49 | /* FIX: this value is picked at random */ | 49 | /* FIX: this value is picked at random */ |
50 | #define BATTERY_SCALE_FACTOR 6000 | 50 | #define BATTERY_SCALE_FACTOR 6000 |
51 | /* full-scale ADC readout (2^8) in millivolt */ | 51 | /* full-scale ADC readout (2^10) in millivolt */ |
52 | 52 | ||
53 | /* Returns battery voltage from ADC [millivolts] */ | 53 | /* Returns battery voltage from ADC [millivolts] */ |
54 | unsigned int battery_adc_voltage(void) | 54 | unsigned int battery_adc_voltage(void) |
55 | { | 55 | { |
56 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 8; | 56 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; |
57 | } | 57 | } |
58 | 58 | ||