mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
c200v1/e200v1: Add battery charging. This should be usable on v2 players but those should be evaluated for current, endpoint voltage and whether or not accurate battery readings may always be obtained (which determines algorithm setup and behavior).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19748 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b84fe020a5
commit
7d7969114d
11 changed files with 378 additions and 52 deletions
|
|
@ -106,7 +106,7 @@
|
|||
#include "debug-target.h"
|
||||
#endif
|
||||
|
||||
#if defined(SANSA_E200) || defined(PHILIPS_SA9200)
|
||||
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
|
||||
#include "ascodec.h"
|
||||
#include "as3514.h"
|
||||
#endif
|
||||
|
|
@ -1251,10 +1251,6 @@ extern unsigned char serbuf[];
|
|||
lcd_puts(0, line++, buf);
|
||||
snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT));
|
||||
lcd_puts(0, line++, buf);
|
||||
snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X",
|
||||
ascodec_read(AS3514_CHARGER),
|
||||
ascodec_read(AS3514_IRQ_ENRD0));
|
||||
lcd_puts(0, line++, buf);
|
||||
#endif
|
||||
#endif
|
||||
lcd_update();
|
||||
|
|
@ -1757,6 +1753,32 @@ static bool view_battery(void)
|
|||
}
|
||||
|
||||
lcd_puts(0, line++, buf);
|
||||
#elif defined(SANSA_E200) || defined(SANSA_C200)
|
||||
const int first = CHARGE_STATE_DISABLED;
|
||||
static const char * const chrgstate_strings[] =
|
||||
{
|
||||
[CHARGE_STATE_DISABLED-first] = "Disabled",
|
||||
[CHARGE_STATE_ERROR-first] = "Error",
|
||||
[DISCHARGING-first] = "Discharging",
|
||||
[CHARGING-first] = "Charging",
|
||||
};
|
||||
const char *str = NULL;
|
||||
|
||||
snprintf(buf, 30, "Charger: %s",
|
||||
charger_inserted() ? "present" : "absent");
|
||||
lcd_puts(0, 3, buf);
|
||||
|
||||
y = charge_state - first;
|
||||
if ((unsigned)y < ARRAYLEN(chrgstate_strings))
|
||||
str = chrgstate_strings[y];
|
||||
|
||||
snprintf(buf, sizeof(buf), "State: %s",
|
||||
str ? str : "<unknown>");
|
||||
lcd_puts(0, 4, buf);
|
||||
|
||||
snprintf(buf, sizeof(buf), "CHARGER: %02X",
|
||||
ascodec_read(AS3514_CHARGER));
|
||||
lcd_puts(0, 5, buf);
|
||||
#else
|
||||
snprintf(buf, 30, "Charger: %s",
|
||||
charger_inserted() ? "present" : "absent");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue