mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
Samsung YH-920: Proper values for battery monitoring, based on the OF formula.
Change-Id: I894eb6bad600bd059fe9a5ea1103737a736d4005
This commit is contained in:
parent
eaaff2680b
commit
f74edac8c7
2 changed files with 7 additions and 8 deletions
|
|
@ -63,7 +63,8 @@ unsigned short adc_scan(int channel)
|
||||||
|
|
||||||
adcdata[channel] = (adc_data_1<<2 | adc_data_2);
|
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 */
|
/* ADC values read low if PLL is enabled */
|
||||||
if(PLL_CONTROL & 0x80000000){
|
if(PLL_CONTROL & 0x80000000){
|
||||||
adcdata[channel] += 0x14;
|
adcdata[channel] += 0x14;
|
||||||
|
|
|
||||||
|
|
@ -24,31 +24,29 @@
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
|
|
||||||
/* TODO: Not yet calibrated */
|
|
||||||
|
|
||||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||||
{
|
{
|
||||||
3733
|
3523 /* 5% */
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||||
{
|
{
|
||||||
3627
|
3507 /* 3% */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
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 */
|
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||||
const unsigned short percent_to_volt_charge[11] =
|
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 */
|
/* full-scale ADC readout (2^10) in millivolt */
|
||||||
|
|
||||||
/* Returns battery voltage from ADC [millivolts] */
|
/* Returns battery voltage from ADC [millivolts] */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue