From 9ee68cbfd34dfaa5827f3f7dce96952610775106 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Sun, 22 Mar 2009 19:06:54 +0000 Subject: [PATCH] FS#9968: Charging on e200v2 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20465 a1c6a512-1295-4272-9138-f99709370657 --- firmware/SOURCES | 3 ++- firmware/export/config-e200v2.h | 10 +++++----- firmware/target/arm/as3525/powermgmt-target.h | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/firmware/SOURCES b/firmware/SOURCES index 95ed27bd89..82b7b34942 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -1111,7 +1111,8 @@ target/arm/as3525/sansa-e200v2/lcd-e200v2.c target/arm/as3525/sansa-e200v2/button-e200v2.c target/arm/as3525/backlight-e200v2-fuze.c #ifndef BOOTLOADER -target/arm/as3525/powermgmt-as3525.c +target/arm/powermgmt-ascodec.c +target/arm/as3525/sansa-e200v2/powermgmt-e200v2.c #endif /* !BOOTLOADER */ #endif /* !SIMULATOR */ #endif /* SANSA_E200V2 */ diff --git a/firmware/export/config-e200v2.h b/firmware/export/config-e200v2.h index 276fa13903..7f993be512 100644 --- a/firmware/export/config-e200v2.h +++ b/firmware/export/config-e200v2.h @@ -130,14 +130,14 @@ /* define this if the flash memory uses the SecureDigital Memory Card protocol */ #define CONFIG_STORAGE STORAGE_SD -#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ -#define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ -#define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ +#define BATTERY_CAPACITY_DEFAULT 730 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 730 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 730 /* max. capacity selectable */ #define BATTERY_CAPACITY_INC 0 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ -/* Hardware controlled charging? FIXME */ -#define CONFIG_CHARGING CHARGING_SIMPLE +/* Charging implemented in a target-specific algorithm */ +#define CONFIG_CHARGING CHARGING_TARGET /* define this if the unit can be powered or charged via USB */ #define HAVE_USB_POWER diff --git a/firmware/target/arm/as3525/powermgmt-target.h b/firmware/target/arm/as3525/powermgmt-target.h index 691d134ffa..3f23d6d3d7 100644 --- a/firmware/target/arm/as3525/powermgmt-target.h +++ b/firmware/target/arm/as3525/powermgmt-target.h @@ -22,6 +22,8 @@ #ifndef POWERMGMT_TARGET_H #define POWERMGMT_TARGET_H +#if defined(SANSA_CLIP) + /* Check if topped-off and monitor voltage while plugged. */ #define BATT_FULL_VOLTAGE 4160 #define BATT_VAUTO_RECHARGE 4100 @@ -30,6 +32,20 @@ #define CHARGER_TOTAL_TIMER (6*3600*2) /* about 1.5 * capacity / current */ #define ADC_BATTERY ADC_BVDD +#elif defined(SANSA_E200V2) + +/* Check if topped-off and monitor voltage while plugged. */ +#define BATT_FULL_VOLTAGE 4160 +#define BATT_VAUTO_RECHARGE 4100 +#define BATT_CHG_V CHG_V_4_20V +#define BATT_CHG_I CHG_I_300MA +#define CHARGER_TOTAL_TIMER (4*3600*2) +#define ADC_BATTERY ADC_BVDD + +#else +#error "Charger settings not defined!" +#endif + void powermgmt_init_target(void); void charging_algorithm_step(void); void charging_algorithm_close(void);