1
0
Fork 0
forked from len0rd/rockbox

Samsung YH-920: Proper values for battery monitoring, based on the OF formula.

Change-Id: I894eb6bad600bd059fe9a5ea1103737a736d4005
This commit is contained in:
Szymon Dziok 2014-07-27 10:42:00 +00:00
parent eaaff2680b
commit f74edac8c7
2 changed files with 7 additions and 8 deletions

View file

@ -63,7 +63,8 @@ unsigned short adc_scan(int channel)
adcdata[channel] = (adc_data_1<<2 | adc_data_2);
#if !(defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) || defined(SAMSUNG_YH820))
#if !(defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) ||\
defined(SAMSUNG_YH820) || defined(SAMSUNG_YH920))
/* ADC values read low if PLL is enabled */
if(PLL_CONTROL & 0x80000000){
adcdata[channel] += 0x14;

View file

@ -24,31 +24,29 @@
#include "adc.h"
#include "powermgmt.h"
/* TODO: Not yet calibrated */
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
{
3733
3523 /* 5% */
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3627
3507 /* 3% */
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
{
{ 3733, 3772, 3821, 3840, 3869, 3917, 3985, 4034, 4072, 4140, 4198 }
{ 3486, 3557, 3628, 3699, 3770, 3841, 3912, 3983, 4054, 4125, 4196 }
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
{
3956, 3995, 4024, 4043, 4063, 4082, 4111, 4140, 4179, 4218, 4266
3486, 3557, 3628, 3699, 3770, 3841, 3912, 3983, 4054, 4125, 4196
};
#define BATTERY_SCALE_FACTOR 4650
#define BATTERY_SCALE_FACTOR 4200
/* full-scale ADC readout (2^10) in millivolt */
/* Returns battery voltage from ADC [millivolts] */