diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-04-06 23:53:19 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-04-06 23:53:19 +0000 |
commit | 43bf39edb718aa510188b3594e583c905dea5a54 (patch) | |
tree | 0b548d7425f68214a64528cb7eae08e4f24a8fe3 /firmware | |
parent | 09e55a921883ab7e71bce19c49adc07705b827f5 (diff) |
First lame attempt to show correct battery level on the iRiver
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6258 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/adc.c | 2 | ||||
-rw-r--r-- | firmware/export/config-h100.h | 4 | ||||
-rw-r--r-- | firmware/export/config.h | 2 | ||||
-rw-r--r-- | firmware/export/powermgmt.h | 8 | ||||
-rw-r--r-- | firmware/powermgmt.c | 4 |
5 files changed, 16 insertions, 4 deletions
diff --git a/firmware/drivers/adc.c b/firmware/drivers/adc.c index fd7916622c..69aeb2996e 100644 --- a/firmware/drivers/adc.c +++ b/firmware/drivers/adc.c @@ -202,6 +202,8 @@ void adc_init(void) GPIO_OUT |= 0x80; /* CS high */ GPIO_OUT &= ~0x00400000; /* CLK low */ + adc_scan(ADC_BATTERY); + tick_add_task(adc_tick); } diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index d8453a96d1..5eef2c7270 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -21,9 +21,9 @@ #define CONFIG_I2C I2C_H100 /* Type of mobile power */ -#define CONFIG_BATTERY BATT_IRIVER +#define CONFIG_BATTERY BATT_LIPOL1300 -#define BATTERY_SCALE_FACTOR 6465 /* FIX: this value is picked at random */ +#define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */ /* Define this if the platform can charge batteries */ #define HAVE_CHARGING 1 diff --git a/firmware/export/config.h b/firmware/export/config.h index 201b5317e3..a47581afc7 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -48,7 +48,7 @@ #define BATT_LIION2200 2200 /* FM/V2 recorder type */ #define BATT_4AA_NIMH 1500 #define BATT_3AAA 1000 /* Ondio */ -#define BATT_IRIVER 2 /* the type used in iRiver h1x0 models */ +#define BATT_LIPOL1300 1300 /* the type used in iRiver h1x0 models */ /* CONFIG_LCD */ #define LCD_GMINI100 0 diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index ccfdede9f9..97daf7ce59 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -35,6 +35,14 @@ #define BATTERY_CAPACITY_MIN 500 #define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable in settings */ #define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */ +#elif CONFIG_BATTERY == BATT_LIPOL1300 /* iRiver H1x0 */ +#define BATTERY_LEVEL_SHUTDOWN 306 /* 3.06V */ +#define BATTERY_LEVEL_EMPTY 330 /* 3.30V */ +#define BATTERY_LEVEL_DANGEROUS 339 /* 3.39V */ +#define BATTERY_LEVEL_FULL 400 /* 4.00V */ +#define BATTERY_CAPACITY_MIN 1300 +#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable in settings */ +#define BATTERY_TYPES_COUNT 1 #else /* Recorder, NiMH */ #define BATTERY_LEVEL_SHUTDOWN 450 /* 4.50V */ #define BATTERY_LEVEL_EMPTY 465 /* 4.65V */ diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 5a1639ca1c..319a99fde6 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -110,7 +110,9 @@ static const short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = #elif CONFIG_BATTERY == BATT_3AAA /* measured values */ { 280, 325, 341, 353, 364, 374, 385, 395, 409, 427, 475 }, /* alkaline */ - { 310, 355, 363, 369, 372, 374, 376, 378, 380, 386, 405 } /* NiMH */ + { 310, 355, 363, 369, 372, 374, 378, 378, 380, 386, 405 } /* NiMH */ +#elif CONFIG_BATTERY == BATT_LIPOL1300 + { 333, 341, 349, 358, 365, 373, 370, 386, 393, 400, 409 } #else /* NiMH */ /* original values were taken directly after charging, but it should show 100% after turning off the device for some hours, too */ |