mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 05:35:20 -05:00
multiple battery types prepared (CONFIG_BATTERY)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5227 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5cf1c97aea
commit
43079ea07f
12 changed files with 43 additions and 21 deletions
|
|
@ -213,10 +213,12 @@ static const struct bit_entry rtc_bits[] =
|
||||||
{1, S_O(discharge), 0, "deep discharge", off_on },
|
{1, S_O(discharge), 0, "deep discharge", off_on },
|
||||||
{1, S_O(trickle_charge), true, "trickle charge", off_on },
|
{1, S_O(trickle_charge), true, "trickle charge", off_on },
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIION
|
#if CONFIG_BATTERY == BATT_LIION2200
|
||||||
{12, S_O(battery_capacity), 2200, "battery capacity", NULL }, /* 1500...3200 */
|
{12, S_O(battery_capacity), 2200, "battery capacity", NULL }, /* 1500...3200 */
|
||||||
#else
|
#elif CONFIG_BATTERY == BATT_4AA_NIMH
|
||||||
{12, S_O(battery_capacity), 1500, "battery capacity", NULL }, /* 1500...3200 */
|
{12, S_O(battery_capacity), 1500, "battery capacity", NULL }, /* 1500...3200 */
|
||||||
|
#elif CONFIG_BATTERY == BATT_3AAA_ALKALINE
|
||||||
|
{12, S_O(battery_capacity), 1000, "battery capacity", NULL },
|
||||||
#endif
|
#endif
|
||||||
{1, S_O(car_adapter_mode), false, "car adapter mode", off_on },
|
{1, S_O(car_adapter_mode), false, "car adapter mode", off_on },
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ void status_draw(bool force_redraw)
|
||||||
if (info.inserted) {
|
if (info.inserted) {
|
||||||
battery_state = true;
|
battery_state = true;
|
||||||
plug_state = true;
|
plug_state = true;
|
||||||
#if defined(HAVE_CHARGE_CTRL) || defined(HAVE_LIION)
|
#if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200
|
||||||
/* zero battery run time if charging */
|
/* zero battery run time if charging */
|
||||||
if (charge_state > 0) {
|
if (charge_state > 0) {
|
||||||
global_settings.runtime = 0;
|
global_settings.runtime = 0;
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,6 @@
|
||||||
/* Define this if you have a FM Recorder key system */
|
/* Define this if you have a FM Recorder key system */
|
||||||
#define HAVE_FMADC 1
|
#define HAVE_FMADC 1
|
||||||
|
|
||||||
/* Define this if you have a LiIon battery */
|
|
||||||
#define HAVE_LIION
|
|
||||||
|
|
||||||
/* Define this if you need to power on ATA */
|
/* Define this if you need to power on ATA */
|
||||||
#define NEEDS_ATA_POWER_ON
|
#define NEEDS_ATA_POWER_ON
|
||||||
|
|
||||||
|
|
@ -37,6 +34,9 @@
|
||||||
/* Define this to the CPU frequency */
|
/* Define this to the CPU frequency */
|
||||||
#define CPU_FREQ 11059200
|
#define CPU_FREQ 11059200
|
||||||
|
|
||||||
|
/* Type of mobile power */
|
||||||
|
#define CONFIG_BATTERY BATT_LIION2200
|
||||||
|
|
||||||
/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
|
/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
|
||||||
#define BATTERY_SCALE_FACTOR 8081
|
#define BATTERY_SCALE_FACTOR 8081
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
/* How to detect USB */
|
/* How to detect USB */
|
||||||
#define USB_FMRECORDERSTYLE 1
|
#define USB_FMRECORDERSTYLE 1
|
||||||
|
|
||||||
/* Define this if the platform has batteries */
|
/* Define this if the platform can charge batteries */
|
||||||
#define HAVE_BATTERIES 1
|
#define HAVE_BATTERIES 1
|
||||||
|
|
||||||
/* The start address index for ROM builds */
|
/* The start address index for ROM builds */
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@
|
||||||
/* Define this if you have a Motorola SCF5249 */
|
/* Define this if you have a Motorola SCF5249 */
|
||||||
#define CONFIG_CPU MCF5249
|
#define CONFIG_CPU MCF5249
|
||||||
|
|
||||||
/* Define this if the platform has batteries */
|
/* Type of mobile power, FIXME: probably different, make new type */
|
||||||
|
#define CONFIG_BATTERY BATT_LIION2200
|
||||||
|
|
||||||
|
/* Define this if the platform can charge batteries */
|
||||||
#define HAVE_BATTERIES 1
|
#define HAVE_BATTERIES 1
|
||||||
|
|
||||||
/* The start address index for ROM builds */
|
/* The start address index for ROM builds */
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@
|
||||||
/* Define this to the CPU frequency */
|
/* Define this to the CPU frequency */
|
||||||
#define CPU_FREQ 12000000
|
#define CPU_FREQ 12000000
|
||||||
|
|
||||||
|
/* Type of mobile power */
|
||||||
|
#define CONFIG_BATTERY BATT_3AAA_ALKALINE
|
||||||
|
|
||||||
/* Battery scale factor (measured from Jörg's FM) */
|
/* Battery scale factor (measured from Jörg's FM) */
|
||||||
#define BATTERY_SCALE_FACTOR 4785 /* 4.890V read as 0x3FE */
|
#define BATTERY_SCALE_FACTOR 4785 /* 4.890V read as 0x3FE */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@
|
||||||
/* Define this to the CPU frequency */
|
/* Define this to the CPU frequency */
|
||||||
#define CPU_FREQ 12000000
|
#define CPU_FREQ 12000000
|
||||||
|
|
||||||
|
/* Type of mobile power */
|
||||||
|
#define CONFIG_BATTERY BATT_3AAA_ALKALINE
|
||||||
|
|
||||||
/* Battery scale factor (measured from Jörg's FM) */
|
/* Battery scale factor (measured from Jörg's FM) */
|
||||||
#define BATTERY_SCALE_FACTOR 4785 /* 4.890V read as 0x3FE */
|
#define BATTERY_SCALE_FACTOR 4785 /* 4.890V read as 0x3FE */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@
|
||||||
/* Define this to the CPU frequency */
|
/* Define this to the CPU frequency */
|
||||||
#define CPU_FREQ 12000000 /* cycle time ~83.3ns */
|
#define CPU_FREQ 12000000 /* cycle time ~83.3ns */
|
||||||
|
|
||||||
|
/* Type of mobile power */
|
||||||
|
#define CONFIG_BATTERY BATT_4AA_NIMH
|
||||||
|
|
||||||
/* Battery scale factor (?) */
|
/* Battery scale factor (?) */
|
||||||
#define BATTERY_SCALE_FACTOR 6546
|
#define BATTERY_SCALE_FACTOR 6546
|
||||||
|
|
||||||
|
|
@ -44,7 +47,7 @@
|
||||||
/* How to detect USB */
|
/* How to detect USB */
|
||||||
#define USB_PLAYERSTYLE 1
|
#define USB_PLAYERSTYLE 1
|
||||||
|
|
||||||
/* Define this if the platform has batteries */
|
/* Define this if the platform can charge batteries */
|
||||||
#define HAVE_BATTERIES 1
|
#define HAVE_BATTERIES 1
|
||||||
|
|
||||||
/* Define this for programmable LED available */
|
/* Define this for programmable LED available */
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@
|
||||||
/* Define this to the CPU frequency */
|
/* Define this to the CPU frequency */
|
||||||
#define CPU_FREQ 11059200
|
#define CPU_FREQ 11059200
|
||||||
|
|
||||||
|
/* Type of mobile power */
|
||||||
|
#define CONFIG_BATTERY BATT_4AA_NIMH
|
||||||
|
|
||||||
/* Battery scale factor (?) */
|
/* Battery scale factor (?) */
|
||||||
#define BATTERY_SCALE_FACTOR 6465
|
#define BATTERY_SCALE_FACTOR 6465
|
||||||
|
|
||||||
|
|
@ -52,7 +55,7 @@
|
||||||
/* How to detect USB */
|
/* How to detect USB */
|
||||||
#define USB_RECORDERSTYLE 1
|
#define USB_RECORDERSTYLE 1
|
||||||
|
|
||||||
/* Define this if the platform has batteries */
|
/* Define this if the platform can charge batteries */
|
||||||
#define HAVE_BATTERIES 1
|
#define HAVE_BATTERIES 1
|
||||||
|
|
||||||
/* The start address index for ROM builds */
|
/* The start address index for ROM builds */
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,6 @@
|
||||||
/* Define this if you have a FM Recorder key system */
|
/* Define this if you have a FM Recorder key system */
|
||||||
#define HAVE_FMADC 1
|
#define HAVE_FMADC 1
|
||||||
|
|
||||||
/* Define this if you have a LiIon battery */
|
|
||||||
#define HAVE_LIION
|
|
||||||
|
|
||||||
/* Define this if you need to power on ATA */
|
/* Define this if you need to power on ATA */
|
||||||
#define NEEDS_ATA_POWER_ON
|
#define NEEDS_ATA_POWER_ON
|
||||||
|
|
||||||
|
|
@ -37,6 +34,9 @@
|
||||||
/* Define this to the CPU frequency */
|
/* Define this to the CPU frequency */
|
||||||
#define CPU_FREQ 11059200
|
#define CPU_FREQ 11059200
|
||||||
|
|
||||||
|
/* Type of mobile power */
|
||||||
|
#define CONFIG_BATTERY BATT_LIION2200
|
||||||
|
|
||||||
/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
|
/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
|
||||||
#define BATTERY_SCALE_FACTOR 8081
|
#define BATTERY_SCALE_FACTOR 8081
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
/* How to detect USB */
|
/* How to detect USB */
|
||||||
#define USB_FMRECORDERSTYLE 1
|
#define USB_FMRECORDERSTYLE 1
|
||||||
|
|
||||||
/* Define this if the platform has batteries */
|
/* Define this if the platform can charge batteries */
|
||||||
#define HAVE_BATTERIES 1
|
#define HAVE_BATTERIES 1
|
||||||
|
|
||||||
/* The start address index for ROM builds */
|
/* The start address index for ROM builds */
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,11 @@
|
||||||
#define RECORDER_PAD 1
|
#define RECORDER_PAD 1
|
||||||
#define ONDIO_PAD 2
|
#define ONDIO_PAD 2
|
||||||
|
|
||||||
|
/* CONFIG_BATTERY */
|
||||||
|
#define BATT_LIION2200 2200 /* FM/V2 recorder type */
|
||||||
|
#define BATT_4AA_NIMH 1500
|
||||||
|
#define BATT_3AAA_ALKALINE 1000
|
||||||
|
|
||||||
/* now go and pick yours */
|
/* now go and pick yours */
|
||||||
#if defined(ARCHOS_PLAYER)
|
#if defined(ARCHOS_PLAYER)
|
||||||
#include "config-player.h"
|
#include "config-player.h"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef _POWERMGMT_H_
|
#ifndef _POWERMGMT_H_
|
||||||
#define _POWERMGMT_H_
|
#define _POWERMGMT_H_
|
||||||
|
|
||||||
#ifdef HAVE_LIION /* FM Recorder, LiIon */
|
#if CONFIG_BATTERY == BATT_LIION2200 /* FM Recorder, LiIon */
|
||||||
#define BATTERY_LEVEL_SHUTDOWN 260 /* 2.60V */
|
#define BATTERY_LEVEL_SHUTDOWN 260 /* 2.60V */
|
||||||
#define BATTERY_LEVEL_EMPTY 265 /* 2.65V */
|
#define BATTERY_LEVEL_EMPTY 265 /* 2.65V */
|
||||||
#define BATTERY_LEVEL_DANGEROUS 280 /* 2.80V */
|
#define BATTERY_LEVEL_DANGEROUS 280 /* 2.80V */
|
||||||
|
|
@ -71,7 +71,7 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute
|
||||||
|
|
||||||
#endif /* HAVE_CHARGE_CTRL */
|
#endif /* HAVE_CHARGE_CTRL */
|
||||||
|
|
||||||
#if defined(HAVE_CHARGE_CTRL) || defined(HAVE_LIION)
|
#if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200
|
||||||
extern int charge_state; /* tells what the charger is doing (for info display): 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */
|
extern int charge_state; /* tells what the charger is doing (for info display): 0: decharging/charger off, 1: charge, 2: top-off, 3: trickle */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ static const int poweroff_idle_timeout_value[15] =
|
||||||
static const int percent_to_volt_decharge[11] =
|
static const int percent_to_volt_decharge[11] =
|
||||||
/* voltages (centivolt) of 0%, 10%, ... 100% when charging disabled */
|
/* voltages (centivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIION
|
#if CONFIG_BATTERY == BATT_LIION2200
|
||||||
/* measured values */
|
/* measured values */
|
||||||
260, 285, 295, 303, 311, 320, 330, 345, 360, 380, 400
|
260, 285, 295, 303, 311, 320, 330, 345, 360, 380, 400
|
||||||
#else /* NiMH */
|
#else /* NiMH */
|
||||||
|
|
@ -112,7 +112,7 @@ void set_battery_capacity(int capacity)
|
||||||
battery_capacity = 1500;
|
battery_capacity = 1500;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_CHARGE_CTRL) || defined(HAVE_LIION)
|
#if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200
|
||||||
int charge_state = 0; /* at the beginning, the
|
int charge_state = 0; /* at the beginning, the
|
||||||
charger does nothing */
|
charger does nothing */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -443,7 +443,7 @@ static void power_thread(void)
|
||||||
int i;
|
int i;
|
||||||
int avg, ok_samples, spin_samples;
|
int avg, ok_samples, spin_samples;
|
||||||
int current = 0;
|
int current = 0;
|
||||||
#ifdef HAVE_LIION
|
#if CONFIG_BATTERY == BATT_LIION2200
|
||||||
int charging_current;
|
int charging_current;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CHARGE_CTRL
|
#ifdef HAVE_CHARGE_CTRL
|
||||||
|
|
@ -535,7 +535,7 @@ static void power_thread(void)
|
||||||
#endif /* MEM == 8 */
|
#endif /* MEM == 8 */
|
||||||
#endif /* HAVE_CHARGE_CONTROL */
|
#endif /* HAVE_CHARGE_CONTROL */
|
||||||
|
|
||||||
#ifdef HAVE_LIION
|
#if CONFIG_BATTERY == BATT_LIION2200
|
||||||
/* We use the information from the ADC_EXT_POWER ADC channel, which
|
/* We use the information from the ADC_EXT_POWER ADC channel, which
|
||||||
tells us the charging current from the LTC1734. When DC is
|
tells us the charging current from the LTC1734. When DC is
|
||||||
connected (either via the external adapter, or via USB), we try
|
connected (either via the external adapter, or via USB), we try
|
||||||
|
|
@ -790,7 +790,7 @@ static void power_thread(void)
|
||||||
powermgmt_last_cycle_startstop_min++;
|
powermgmt_last_cycle_startstop_min++;
|
||||||
|
|
||||||
#endif /* HAVE_CHARGE_CTRL*/
|
#endif /* HAVE_CHARGE_CTRL*/
|
||||||
#endif /* HAVE_LIION */
|
#endif /* # if CONFIG_BATTERY == BATT_LIION2200 */
|
||||||
|
|
||||||
/* sleep for roughly a minute */
|
/* sleep for roughly a minute */
|
||||||
#ifdef HAVE_CHARGE_CTRL
|
#ifdef HAVE_CHARGE_CTRL
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue