Sansa Clip: enable battery charging.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20006 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Bertrik Sikken 2009-02-14 16:19:21 +00:00
parent 459b4f632b
commit 01d4b4c997
5 changed files with 51 additions and 20 deletions

View file

@ -20,9 +20,6 @@
****************************************************************************/
#include "config.h"
#include "adc.h"
#include "adc-target.h"
#include "powermgmt.h"
/* The battery manufacturer's website shows discharge curves down to 3.0V,
so 'dangerous' and 'shutoff' levels of 3.4V and 3.3V should be safe.
@ -52,13 +49,3 @@ const unsigned short percent_to_volt_charge[11] =
};
#endif /* CONFIG_CHARGING */
/* ADC should read 0x3ff=5.12V */
#define BATTERY_SCALE_FACTOR 5125
/* full-scale ADC readout (2^10) in millivolt */
/* Returns battery voltage from ADC [millivolts] */
unsigned int battery_adc_voltage(void)
{
return (adc_read(ADC_RTCSUP) * BATTERY_SCALE_FACTOR) >> 10;
}