summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2009-01-11 10:07:22 +0000
committerMichael Sevakis <jethead71@rockbox.org>2009-01-11 10:07:22 +0000
commit7d7969114da36a99afc4d80576ff9b089cb09e50 (patch)
tree48c3c574e382d80454c28a6b77de64a64f3cedcd /apps
parentb84fe020a5bc497cee9b88eb782c2d4a9b7be711 (diff)
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
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 10d69b018c..7477bb001c 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -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");