diff options
author | Amaury Pouly <pamaury@rockbox.org> | 2011-11-14 21:47:59 +0000 |
---|---|---|
committer | Amaury Pouly <pamaury@rockbox.org> | 2011-11-14 21:47:59 +0000 |
commit | e7e4b131d06f748400b5299d4d1ebfb38f9f08bf (patch) | |
tree | 745994b863c5bd4bfbe9d7c1540730558ada6729 | |
parent | 9e4299f6f09707fcde3aef7dd9ab3c4e6b843ce1 (diff) | |
download | rockbox-e7e4b131d06f748400b5299d4d1ebfb38f9f08bf.tar.gz rockbox-e7e4b131d06f748400b5299d4d1ebfb38f9f08bf.zip |
imx233: fix prototype and battery conversion setup code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30989 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/imx233/lradc-imx233.c | 12 | ||||
-rw-r--r-- | firmware/target/arm/imx233/lradc-imx233.h | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/firmware/target/arm/imx233/lradc-imx233.c b/firmware/target/arm/imx233/lradc-imx233.c index 1101e3d32d..8b065bffea 100644 --- a/firmware/target/arm/imx233/lradc-imx233.c +++ b/firmware/target/arm/imx233/lradc-imx233.c | |||
@@ -177,12 +177,14 @@ int imx233_lradc_sense_die_temperature(int nmos_chan, int pmos_chan) | |||
177 | return (diff * 1012) / 4000; | 177 | return (diff * 1012) / 4000; |
178 | } | 178 | } |
179 | 179 | ||
180 | void imx233_lradc_setup_battery_conversion(bool automatic, int scale_factor) | 180 | void imx233_lradc_setup_battery_conversion(bool automatic, unsigned long scale_factor) |
181 | { | 181 | { |
182 | __REG_CLR(HW_LRADC_CONVERSION) = HW_LRADC_CONVERSION__AUTOMATIC | | 182 | __REG_CLR(HW_LRADC_CONVERSION) = HW_LRADC_CONVERSION__SCALE_FACTOR_BM; |
183 | HW_LRADC_CONVERSION__SCALE_FACTOR_BM; | 183 | __REG_SET(HW_LRADC_CONVERSION) = scale_factor; |
184 | __REG_SET(HW_LRADC_CONVERSION) = scale_factor | | 184 | if(automatic) |
185 | automatic ? HW_LRADC_CONVERSION__AUTOMATIC : 0; | 185 | __REG_SET(HW_LRADC_CONVERSION) = HW_LRADC_CONVERSION__AUTOMATIC; |
186 | else | ||
187 | __REG_CLR(HW_LRADC_CONVERSION) = HW_LRADC_CONVERSION__AUTOMATIC; | ||
186 | } | 188 | } |
187 | 189 | ||
188 | int imx233_lradc_read_battery_voltage(void) | 190 | int imx233_lradc_read_battery_voltage(void) |
diff --git a/firmware/target/arm/imx233/lradc-imx233.h b/firmware/target/arm/imx233/lradc-imx233.h index fb0085fc74..d79ebe0eff 100644 --- a/firmware/target/arm/imx233/lradc-imx233.h +++ b/firmware/target/arm/imx233/lradc-imx233.h | |||
@@ -130,7 +130,7 @@ void imx233_lradc_release_delay(int dchan); | |||
130 | * channels must already be configured as nmos and pmos */ | 130 | * channels must already be configured as nmos and pmos */ |
131 | int imx233_lradc_sense_die_temperature(int nmos_chan, int pmos_chan); | 131 | int imx233_lradc_sense_die_temperature(int nmos_chan, int pmos_chan); |
132 | 132 | ||
133 | void imx233_lradc_setup_battery_conversion(bool automatic, int scale_factor); | 133 | void imx233_lradc_setup_battery_conversion(bool automatic, unsigned long scale_factor); |
134 | // read scaled voltage, only available after proper setup | 134 | // read scaled voltage, only available after proper setup |
135 | int imx233_lradc_read_battery_voltage(void); | 135 | int imx233_lradc_read_battery_voltage(void); |
136 | 136 | ||