Sansa Clip: enable battery charging.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20006 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
459b4f632b
commit
01d4b4c997
5 changed files with 51 additions and 20 deletions
|
@ -106,7 +106,8 @@
|
|||
#include "debug-target.h"
|
||||
#endif
|
||||
|
||||
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
|
||||
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \
|
||||
|| defined(SANSA_CLIP)
|
||||
#include "ascodec.h"
|
||||
#include "as3514.h"
|
||||
#endif
|
||||
|
@ -1758,7 +1759,7 @@ static bool view_battery(void)
|
|||
}
|
||||
|
||||
lcd_puts(0, line++, buf);
|
||||
#elif defined(SANSA_E200) || defined(SANSA_C200)
|
||||
#elif defined(SANSA_E200) || defined(SANSA_C200) || defined(SANSA_CLIP)
|
||||
const int first = CHARGE_STATE_DISABLED;
|
||||
static const char * const chrgstate_strings[] =
|
||||
{
|
||||
|
|
|
@ -1094,6 +1094,7 @@ target/arm/as3525/sansa-clip/lcd-as-clip.S
|
|||
target/arm/as3525/sansa-clip/button-clip.c
|
||||
target/arm/as3525/sansa-clip/backlight-clip.c
|
||||
#ifndef BOOTLOADER
|
||||
target/arm/powermgmt-ascodec.c
|
||||
target/arm/as3525/sansa-clip/powermgmt-clip.c
|
||||
#endif /* !BOOTLOADER */
|
||||
#endif /* !SIMULATOR */
|
||||
|
|
|
@ -134,14 +134,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 380 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 380 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 380 /* 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
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "adc-target.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
/* The battery manufacturer's website shows discharge curves down to 3.0V,
|
||||
so 'dangerous' and 'shutoff' levels of 3.4V and 3.3V should be safe.
|
||||
|
@ -52,13 +49,3 @@ const unsigned short percent_to_volt_charge[11] =
|
|||
};
|
||||
#endif /* CONFIG_CHARGING */
|
||||
|
||||
/* ADC should read 0x3ff=5.12V */
|
||||
#define BATTERY_SCALE_FACTOR 5125
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_RTCSUP) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
||||
|
|
42
firmware/target/arm/as3525/sansa-clip/powermgmt-target.h
Normal file
42
firmware/target/arm/as3525/sansa-clip/powermgmt-target.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Michael Sevakis
|
||||
* Copyright (C) 2008 by Bertrik Sikken
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef POWERMGMT_TARGET_H
|
||||
#define POWERMGMT_TARGET_H
|
||||
|
||||
/* 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_100MA
|
||||
#define CHARGER_TOTAL_TIMER (6*3600*2) /* about 1.5 * capacity / current */
|
||||
#define ADC_BATTERY ADC_BVDD
|
||||
|
||||
void powermgmt_init_target(void);
|
||||
void charging_algorithm_step(void);
|
||||
void charging_algorithm_close(void);
|
||||
|
||||
/* We want to be able to reset the averaging filter */
|
||||
#define HAVE_RESET_BATTERY_FILTER
|
||||
|
||||
#define BATT_AVE_SAMPLES 32
|
||||
|
||||
#endif /* POWERMGMT_TARGET_H */
|
Loading…
Reference in a new issue