1
0
Fork 0
forked from len0rd/rockbox

imx233: fix prototype and battery conversion setup code

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30989 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Amaury Pouly 2011-11-14 21:47:59 +00:00
parent 9e4299f6f0
commit e7e4b131d0
2 changed files with 8 additions and 6 deletions

View file

@ -177,12 +177,14 @@ int imx233_lradc_sense_die_temperature(int nmos_chan, int pmos_chan)
return (diff * 1012) / 4000; return (diff * 1012) / 4000;
} }
void imx233_lradc_setup_battery_conversion(bool automatic, int scale_factor) void imx233_lradc_setup_battery_conversion(bool automatic, unsigned long scale_factor)
{ {
__REG_CLR(HW_LRADC_CONVERSION) = HW_LRADC_CONVERSION__AUTOMATIC | __REG_CLR(HW_LRADC_CONVERSION) = HW_LRADC_CONVERSION__SCALE_FACTOR_BM;
HW_LRADC_CONVERSION__SCALE_FACTOR_BM; __REG_SET(HW_LRADC_CONVERSION) = scale_factor;
__REG_SET(HW_LRADC_CONVERSION) = scale_factor | if(automatic)
automatic ? HW_LRADC_CONVERSION__AUTOMATIC : 0; __REG_SET(HW_LRADC_CONVERSION) = HW_LRADC_CONVERSION__AUTOMATIC;
else
__REG_CLR(HW_LRADC_CONVERSION) = HW_LRADC_CONVERSION__AUTOMATIC;
} }
int imx233_lradc_read_battery_voltage(void) int imx233_lradc_read_battery_voltage(void)

View file

@ -130,7 +130,7 @@ void imx233_lradc_release_delay(int dchan);
* channels must already be configured as nmos and pmos */ * channels must already be configured as nmos and pmos */
int imx233_lradc_sense_die_temperature(int nmos_chan, int pmos_chan); int imx233_lradc_sense_die_temperature(int nmos_chan, int pmos_chan);
void imx233_lradc_setup_battery_conversion(bool automatic, int scale_factor); void imx233_lradc_setup_battery_conversion(bool automatic, unsigned long scale_factor);
// read scaled voltage, only available after proper setup // read scaled voltage, only available after proper setup
int imx233_lradc_read_battery_voltage(void); int imx233_lradc_read_battery_voltage(void);