CONFIG_CHARGING
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12384 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 9d449d7..a27ea50 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1411,7 +1411,7 @@
snprintf(buf, 30, "External: %d.%02d V", y / 100, y % 100);
lcd_puts(0, 2, buf);
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
#if CONFIG_CHARGING == CHARGING_CONTROL
snprintf(buf, 30, "Chgr: %s %s",
charger_inserted() ? "present" : "absent",
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index d533e33..0768c32 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -823,7 +823,7 @@
}
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
case 'p': /* External power plugged in? */
{
if(charger_input_state==CHARGER)
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index f1bd58d..0086abb 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -146,7 +146,7 @@
#ifdef HAVE_USB_POWER
bar->info.usb_inserted = usb_inserted();
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
bar->info.inserted = (charger_input_state == CHARGER);
if (bar->info.inserted)
{
@@ -245,7 +245,7 @@
STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH,
STATUSBAR_HEIGHT);
#endif /* HAVE_USB_POWER */
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
#ifdef HAVE_USB_POWER
else
#endif
@@ -358,7 +358,7 @@
unsigned int prevfg = 0;
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
if (batt_charge_step >= 0)
{
fill = percent * (STATUSBAR_BATTERY_WIDTH-3) / 100;
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index 516598d..9269a7e 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -40,7 +40,7 @@
int minute;
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
bool inserted;
#endif
#ifdef HAVE_USB_POWER
diff --git a/apps/main.c b/apps/main.c
index 22eda84..a912e07 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -293,7 +293,7 @@
{
int rc;
bool mounted = false;
-#if defined(CONFIG_CHARGING) && (CONFIG_CPU == SH7034)
+#if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
/* if nobody initialized ATA before, I consider this a cold start */
bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */
#endif
@@ -372,7 +372,7 @@
screen_access_init();
gui_syncstatusbar_init(&statusbars);
-#if defined(CONFIG_CHARGING) && (CONFIG_CPU == SH7034)
+#if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
if (coldstart && charger_inserted()
&& !global_settings.car_adapter_mode
#ifdef ATA_POWER_PLAYERSTYLE
@@ -536,7 +536,7 @@
}
#endif /* #ifdef AUTOROCK */
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
car_adapter_mode_init();
#endif
}
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index a1067fc..5dc14ce 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -79,7 +79,7 @@
/* LCD MENU */
#ifdef CONFIG_BACKLIGHT
MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL);
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
MENUITEM_SETTING(backlight_timeout_plugged,
&global_settings.backlight_timeout_plugged, NULL);
#endif
@@ -174,7 +174,7 @@
NULL, bitmap_icons_6x8[Icon_Display_menu]
#ifdef CONFIG_BACKLIGHT
,&backlight_timeout
-# ifdef CONFIG_CHARGING
+# if CONFIG_CHARGING
,&backlight_timeout_plugged
# endif
# ifdef HAS_BUTTON_HOLD
@@ -218,7 +218,7 @@
MENUITEM_SETTING(remote_backlight_timeout,
&global_settings.remote_backlight_timeout, NULL);
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
MENUITEM_SETTING(remote_backlight_timeout_plugged,
&global_settings.remote_backlight_timeout_plugged, NULL);
#endif
@@ -260,7 +260,7 @@
MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU),
NULL, bitmap_icons_6x8[Icon_Remote_Display_menu],
&remote_backlight_timeout,
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
&remote_backlight_timeout_plugged,
#endif
#ifdef HAS_REMOTE_BUTTON_HOLD
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 22bd1d8..399002c 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -110,7 +110,7 @@
MENUITEM_SETTING(battery_capacity, &global_settings.battery_capacity, NULL);
MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL);
#ifdef HAVE_USB_POWER
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
static int usbcharging_callback(int action,const struct menu_item_ex *this_item)
{
(void)this_item;
@@ -131,7 +131,7 @@
&battery_type,
#endif
#ifdef HAVE_USB_POWER
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
&usb_charging,
#endif
#endif
@@ -272,7 +272,7 @@
}
MENUITEM_SETTING(line_in, &global_settings.line_in, linein_callback);
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL);
#endif
@@ -296,7 +296,7 @@
#if CONFIG_CODEC == MAS3507D
&line_in,
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
&car_adapter_mode,
#endif
);
diff --git a/apps/misc.c b/apps/misc.c
index d072d4f..ad93dc2 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -595,7 +595,7 @@
#else
int i;
-#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
+#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
if(!charger_inserted())
#endif
{
@@ -668,7 +668,7 @@
return false;
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
static bool waiting_to_resume_play = false;
static long play_resume_tick;
@@ -774,7 +774,7 @@
if (!clean_shutdown(callback, parameter))
return SYS_POWEROFF;
break;
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
case SYS_CHARGER_CONNECTED:
car_adapter_mode_processing(true);
return SYS_CHARGER_CONNECTED;
diff --git a/apps/plugin.c b/apps/plugin.c
index dd82a8d..ebf0484 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -33,7 +33,7 @@
#include "splash.h"
#include "logf.h"
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
#include "power.h"
#endif
@@ -406,7 +406,7 @@
#ifndef SIMULATOR
battery_voltage,
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
charger_inserted,
# if CONFIG_CHARGING == CHARGING_MONITOR
charging_state,
diff --git a/apps/plugin.h b/apps/plugin.h
index daab88e..a48a65d 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -510,7 +510,7 @@
#ifndef SIMULATOR
unsigned int (*battery_voltage)(void);
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
bool (*charger_inserted)(void);
# if CONFIG_CHARGING == CHARGING_MONITOR
bool (*charging_state)(void);
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 4f1016b..fff3c2f 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -156,11 +156,11 @@
/* use long for aligning */
unsigned long thread_stack[THREAD_STACK_SIZE/sizeof(long)];
-#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER)
+#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
unsigned int charge_state(void)
{
unsigned int ret = 0;
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
if(rb->charger_inserted())
ret = BIT_CHARGER;
#if CONFIG_CHARGING == CHARGING_MONITOR
@@ -182,7 +182,7 @@
int fd, buffelements, tick = 1, i = 0, skipped = 0, exit = 0;
int fst = 0, lst = 0; /* first and last skipped tick */
unsigned int last_voltage = 0;
-#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER)
+#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
unsigned int last_state = 0;
#endif
long sleep_time;
@@ -230,7 +230,7 @@
rb->fdprintf(fd,
"%02d:%02d:%02d, %05d, %03d%%, "
"%02d:%02d, %04d, %04d"
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
", %c"
#if CONFIG_CHARGING == CHARGING_MONITOR
", %c"
@@ -243,7 +243,7 @@
HMS(secs), secs, bat[j].level,
bat[j].eta / 60, bat[j].eta % 60,
-#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER)
+#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
(bat[j].voltage &
(~(BIT_CHARGER|BIT_CHARGING|BIT_USB_POWER)))
*10,
@@ -251,7 +251,7 @@
bat[j].voltage * 10,
#endif
temp + 1 + (j-i)
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
,(bat[j].voltage & BIT_CHARGER)?'A':'-'
#if CONFIG_CHARGING == CHARGING_MONITOR
,(bat[j].voltage & BIT_CHARGING)?'C':'-'
@@ -288,7 +288,7 @@
timeflag = true;
if(last_voltage != (current_voltage=rb->battery_voltage())
-#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER)
+#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
|| last_state != charge_state()
#endif
)
@@ -308,7 +308,7 @@
bat[i].level = rb->battery_level();
bat[i].eta = rb->battery_time();
last_voltage = bat[i].voltage = current_voltage;
-#if defined(CONFIG_CHARGING) || defined(HAVE_USB_POWER)
+#if CONFIG_CHARGING || defined(HAVE_USB_POWER)
bat[i].voltage |= last_state = charge_state();
#endif
i++;
@@ -448,7 +448,7 @@
"Battery type: %d mAh Buffer Entries: %d\n"
" Time:, Seconds:, Level:, Time Left:, Voltage[mV]:,"
" M/DA:"
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
", C:"
#endif
#if CONFIG_CHARGING == CHARGING_MONITOR
diff --git a/apps/screens.c b/apps/screens.c
index d74b7c1..c7841c6 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -171,7 +171,7 @@
}
#endif
-#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
+#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
#ifdef HAVE_LCD_BITMAP
static void charging_display_info(bool animate)
@@ -778,7 +778,7 @@
#endif /* BUTTON_F3 */
#endif /* CONFIG_KEYPAD in (RECORDER_PAD |IRIVER_H100_PAD | IRIVER_H300_PAD) */
-#if defined(CONFIG_CHARGING) || defined(SIMULATOR)
+#if CONFIG_CHARGING || defined(SIMULATOR)
void charging_splash(void)
{
gui_syncsplash(2*HZ, true, (unsigned char *)str(LANG_BATTERY_CHARGE));
@@ -1342,7 +1342,7 @@
}
if (state & 1) {
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
if (charger_inserted()
#ifdef HAVE_USB_POWER
|| usb_powered()
diff --git a/apps/settings.c b/apps/settings.c
index 1a1a085..8c51181 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -665,7 +665,7 @@
#endif
#ifdef HAVE_USB_POWER
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
usb_charging_enable(global_settings.usb_charging);
#endif
#endif
@@ -699,7 +699,7 @@
lcd_remote_emireduce(global_settings.remote_reduce_ticking);
#endif
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
#endif
#ifdef HAS_REMOTE_BUTTON_HOLD
@@ -708,7 +708,7 @@
#endif /* HAVE_REMOTE_LCD */
#ifdef CONFIG_BACKLIGHT
backlight_set_timeout(global_settings.backlight_timeout);
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
#endif
#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
diff --git a/apps/settings.h b/apps/settings.h
index 35eed90..af1d65d 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -629,7 +629,7 @@
#endif
#ifdef HAVE_USB_POWER
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
bool usb_charging;
#endif
#endif
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 37fa7c5..ee70e8c 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -415,7 +415,7 @@
"backlight timeout", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang,
backlight_set_timeout),
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
INT_SETTING_W_CFGVALS(0, backlight_timeout_plugged,
LANG_BACKLIGHT_ON_WHEN_CHARGING, 11,
"backlight timeout plugged", backlight_times_conf, UNIT_SEC,
@@ -475,7 +475,7 @@
BATTERY_CAPACITY_MIN, BATTERY_CAPACITY_MAX, BATTERY_CAPACITY_INC,
NULL, NULL, NULL),
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
OFFON_SETTING(NVRAM(1), car_adapter_mode,
LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL),
#endif
@@ -504,7 +504,7 @@
"remote backlight timeout", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang,
remote_backlight_set_timeout),
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
INT_SETTING_W_CFGVALS(0, remote_backlight_timeout_plugged, LANG_BACKLIGHT, 11,
"remote backlight timeout plugged", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang,
@@ -1057,7 +1057,7 @@
FILENAME_SETTING(0,kbd_file,"kbd","",ROCKBOX_DIR "/",".kbd",MAX_FILENAME+1),
#endif
#ifdef HAVE_USB_POWER
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
OFFON_SETTING(0,usb_charging,LANG_USB_CHARGING,false,"usb charging",NULL),
#endif
#endif
diff --git a/apps/tree.c b/apps/tree.c
index 320e8f7..3074752 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -742,7 +742,7 @@
audio_stop();
}
}
-#if defined(CONFIG_CHARGING) && \
+#if CONFIG_CHARGING && \
(CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
else {
if (!charger_inserted()) {
@@ -755,7 +755,7 @@
}
#endif
}
-#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
+#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
{
static int last_off = 0;
if (current_tick - last_off < 50) {
diff --git a/firmware/backlight.c b/firmware/backlight.c
index d621aa4..99da3df 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -116,7 +116,7 @@
static int backlight_timer;
static int backlight_timeout = 5*HZ;
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
static int backlight_timeout_plugged = 5*HZ;
#endif
#ifdef HAS_BUTTON_HOLD
@@ -126,7 +126,7 @@
#ifdef HAVE_REMOTE_LCD
static int remote_backlight_timer;
static int remote_backlight_timeout = 5*HZ;
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
static int remote_backlight_timeout_plugged = 5*HZ;
#endif
#ifdef HAS_REMOTE_BUTTON_HOLD
@@ -347,7 +347,7 @@
/* Update state of backlight according to timeout setting */
static void backlight_update_state(void)
{
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
if (charger_inserted()
#ifdef HAVE_USB_POWER
|| usb_powered()
@@ -386,7 +386,7 @@
/* Update state of remote backlight according to timeout setting */
static void remote_backlight_update_state(void)
{
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
if (charger_inserted()
#ifdef HAVE_USB_POWER
|| usb_powered()
@@ -503,7 +503,7 @@
static void backlight_tick(void)
{
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
static bool charger_was_inserted = false;
bool charger_is_inserted = charger_inserted()
#ifdef HAVE_USB_POWER
@@ -622,7 +622,7 @@
/* return value in ticks; 0 means always on, <0 means always off */
int backlight_get_current_timeout(void)
{
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
if (charger_inserted()
#ifdef HAVE_USB_POWER
|| usb_powered()
@@ -645,7 +645,7 @@
backlight_update_state();
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
void backlight_set_timeout_plugged(int index)
{
if((unsigned)index >= sizeof(backlight_timeout_value))
@@ -724,7 +724,7 @@
remote_backlight_update_state();
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
void remote_backlight_set_timeout_plugged(int index)
{
if((unsigned)index >= sizeof(backlight_timeout_value))
@@ -766,7 +766,7 @@
/* return value in ticks; 0 means always on, <0 means always off */
int remote_backlight_get_current_timeout(void)
{
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
if (charger_inserted()
#ifdef HAVE_USB_POWER
|| usb_powered()
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index cab62f9..5a40bdf 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -164,7 +164,7 @@
|| btn == RC_POWEROFF_BUTTON
#endif
) &&
-#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
+#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
!charger_inserted() &&
#endif
repeat_count > POWEROFF_COUNT)
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index 872e8b0..78e70f7 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -83,7 +83,7 @@
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
bool charger_inserted(void)
{
#if CONFIG_CHARGING == CHARGING_CONTROL
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 0a59c0b..8283b37 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -230,6 +230,10 @@
#define CONFIG_LED 0
#endif
+#ifndef CONFIG_CHARGING
+#define CONFIG_CHARGING 0
+#endif
+
/* Enable the directory cache and tagcache in RAM if we have
* plenty of RAM. Both features can be enabled independently. */
#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \
diff --git a/firmware/export/power.h b/firmware/export/power.h
index 911ae1d..9eed192 100644
--- a/firmware/export/power.h
+++ b/firmware/export/power.h
@@ -24,7 +24,7 @@
void charger_enable(bool on);
#endif
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
bool charger_inserted(void);
#endif
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 88fc5e8..a31acbc 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -266,7 +266,7 @@
#endif
};
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
charger_input_state_type charger_input_state IDATA_ATTR;
@@ -545,7 +545,7 @@
/ 100 / (CURRENT_MAX_CHG - runcurrent());
}
else
-#elif defined(CONFIG_CHARGING) && CONFIG_BATTERY == BATT_LIPOL1300
+#elif CONFIG_CHARGING && CONFIG_BATTERY == BATT_LIPOL1300
if (charger_inserted()) {
#ifdef IRIVER_H300_SERIES
/* H300_SERIES use CURRENT_MAX_CHG for basic charge time (80%)
@@ -612,7 +612,7 @@
long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ;
int audio_stat = audio_status();
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
/*
* Inhibit shutdown as long as the charger is plugged in. If it is
* unplugged, wait for a timeout period and then shut down.
@@ -656,7 +656,7 @@
if(TIME_AFTER(current_tick, sleeptimer_endtick))
{
audio_stop();
-#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
+#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
if((charger_input_state == CHARGER) ||
(charger_input_state == CHARGER_PLUGGED))
{
@@ -751,7 +751,7 @@
while (ticks > 0) {
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
/*
* Detect charger plugged/unplugged transitions. On a plugged or
* unplugged event, we return immediately, run once through the main
@@ -761,7 +761,7 @@
if(charger_inserted()
#ifdef HAVE_USB_POWER /* USB powered or USB inserted both provide power */
|| usb_powered()
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
|| (usb_inserted() && usb_charging_enabled())
#endif
#endif
@@ -924,7 +924,7 @@
avgbat = avgbat * BATT_AVE_SAMPLES;
battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000;
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
if(charger_inserted()) {
battery_percent = voltage_to_percent(battery_centivolts,
percent_to_volt_charge);
diff --git a/firmware/target/coldfire/iriver/h300/power-h300.c b/firmware/target/coldfire/iriver/h300/power-h300.c
index 7c95aaf..3d726d0 100644
--- a/firmware/target/coldfire/iriver/h300/power-h300.c
+++ b/firmware/target/coldfire/iriver/h300/power-h300.c
@@ -61,7 +61,7 @@
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
bool charger_inserted(void)
{
return (GPIO1_READ & 0x00400000)?true:false;
diff --git a/firmware/usb.c b/firmware/usb.c
index 0a329ad..ee08b04 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -492,7 +492,7 @@
return usb_state == USB_POWERED;
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
bool usb_charging_enable(bool on)
{
bool rc = false;
diff --git a/flash/bootbox/main.c b/flash/bootbox/main.c
index e3af78e..9536d53 100644
--- a/flash/bootbox/main.c
+++ b/flash/bootbox/main.c
@@ -65,7 +65,7 @@
return 0;
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
/*
bool backlight_get_on_when_charging(void)
{
@@ -167,7 +167,7 @@
button_init();
powermgmt_init();
-#if defined(CONFIG_CHARGING) && (CONFIG_CPU == SH7034)
+#if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
if (charger_inserted()
#ifdef ATA_POWER_PLAYERSTYLE
&& !ide_powered() /* relies on probing result from bootloader */