Start cleaning up some #ifdefs in charging code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8391 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
61cd604369
commit
a452c7410d
4 changed files with 9 additions and 22 deletions
|
@ -1333,11 +1333,13 @@ static bool view_runtime(void)
|
|||
#endif
|
||||
|
||||
if (state & 1) {
|
||||
#ifdef HAVE_CHARGING
|
||||
if (charger_inserted())
|
||||
{
|
||||
global_settings.runtime = 0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
global_settings.runtime += ((current_tick - lasttime) / HZ);
|
||||
}
|
||||
|
|
|
@ -653,27 +653,21 @@ static char* get_tag(struct wps_data* wps_data,
|
|||
return buf;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHARGING
|
||||
case 'p': /* External power plugged in? */
|
||||
{
|
||||
#ifdef HAVE_CHARGING
|
||||
if(charger_input_state==CHARGER)
|
||||
#else
|
||||
if(charger_inserted())
|
||||
#endif
|
||||
return "p";
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_CHARGE_CTRL) || \
|
||||
defined (HAVE_CHARGE_STATE) || \
|
||||
CONFIG_BATTERY == BATT_LIION2200
|
||||
case 'c': /* Charging */
|
||||
{
|
||||
if (charge_state == CHARGING
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
|| charge_state == TOPOFF
|
||||
#endif
|
||||
) {
|
||||
if (charge_state == CHARGING || charge_state == TOPOFF) {
|
||||
return "c";
|
||||
} else {
|
||||
return NULL;
|
||||
|
|
|
@ -129,8 +129,6 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
|
|||
bar->info.volume = sound_val2phys(SOUND_VOLUME, global_settings.volume);
|
||||
#ifdef HAVE_CHARGING
|
||||
bar->info.inserted = (charger_input_state == CHARGER);
|
||||
#else
|
||||
bar->info.inserted = charger_inserted();
|
||||
#endif
|
||||
bar->info.battlevel = battery_level();
|
||||
bar->info.battery_safe = battery_level_safe();
|
||||
|
|
|
@ -104,33 +104,26 @@ void power_init(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_CHARGING
|
||||
bool charger_inserted(void)
|
||||
{
|
||||
#if CONFIG_CPU == MCF5249
|
||||
return (GPIO1_READ & 0x00400000)?true:false;
|
||||
#elif defined(GMINI_ARCH)
|
||||
return (P7 & 0x80) == 0;
|
||||
#else
|
||||
#ifdef HAVE_CHARGING
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
#elif defined(HAVE_CHARGE_CTRL)
|
||||
/* Recorder */
|
||||
return adc_read(ADC_EXT_POWER) > 0x100;
|
||||
#else
|
||||
#ifdef HAVE_FMADC
|
||||
#elif defined (HAVE_FMADC)
|
||||
/* FM or V2, can also charge from the USB port */
|
||||
return (adc_read(ADC_CHARGE_REGULATOR) < 0x1FF) ||
|
||||
(adc_read(ADC_USB_POWER) < 0x1FF);
|
||||
#else
|
||||
/* Player */
|
||||
return (PADR & 1) == 0;
|
||||
#endif /* HAVE_FMADC */
|
||||
#endif /* HAVE_CHARGE_CTRL */
|
||||
#else
|
||||
/* Ondio */
|
||||
return false;
|
||||
#endif /* HAVE_CHARGING */
|
||||
#endif
|
||||
}
|
||||
#endif /* HAVE_CHARGING */
|
||||
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
void charger_enable(bool on)
|
||||
|
|
Loading…
Reference in a new issue