diff options
Diffstat (limited to 'firmware')
-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 | ||