summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/debug_menu.c2
-rw-r--r--apps/gui/gwps-common.c2
-rw-r--r--apps/gui/statusbar.c6
-rw-r--r--apps/gui/statusbar.h2
-rw-r--r--apps/main.c6
-rw-r--r--apps/menus/display_menu.c8
-rw-r--r--apps/menus/settings_menu.c8
-rw-r--r--apps/misc.c6
-rw-r--r--apps/plugin.c4
-rw-r--r--apps/plugin.h2
-rw-r--r--apps/plugins/battery_bench.c18
-rw-r--r--apps/screens.c6
-rw-r--r--apps/settings.c6
-rw-r--r--apps/settings.h2
-rw-r--r--apps/settings_list.c8
-rw-r--r--apps/tree.c4
-rw-r--r--firmware/backlight.c18
-rw-r--r--firmware/drivers/button.c2
-rw-r--r--firmware/drivers/power.c2
-rw-r--r--firmware/export/config.h4
-rw-r--r--firmware/export/power.h2
-rw-r--r--firmware/powermgmt.c14
-rw-r--r--firmware/target/coldfire/iriver/h300/power-h300.c2
-rw-r--r--firmware/usb.c2
-rw-r--r--flash/bootbox/main.c4
25 files changed, 72 insertions, 68 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 9d449d78b9..a27ea50fad 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1411,7 +1411,7 @@ static bool view_battery(void)
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 d533e33f9c..0768c32fe9 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -823,7 +823,7 @@ static char* get_tag(struct wps_data* wps_data,
}
}
-#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 f1bd58d70f..0086abb484 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -146,7 +146,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
#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 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
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 @@ void gui_statusbar_icon_battery(struct screen * display, int percent,
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 516598dd00..9269a7efe1 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -40,7 +40,7 @@ struct status_info {
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 22eda84f03..a912e07566 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -293,7 +293,7 @@ static void init(void)
{
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 @@ static void init(void)
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 @@ static void init(void)
}
#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 a1067fc333..5dc14ce5b9 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -79,7 +79,7 @@ int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
/* 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 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
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 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
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 @@ MENUITEM_SETTING(remote_reduce_ticking,
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 22bd1d8c09..399002cd14 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -110,7 +110,7 @@ MAKE_MENU(file_menu, ID2P(LANG_FILE), 0, NOICON,
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 @@ MAKE_MENU(battery_menu, ID2P(LANG_BATTERY_MENU), 0, NOICON,
&battery_type,
#endif
#ifdef HAVE_USB_POWER
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
&usb_charging,
#endif
#endif
@@ -272,7 +272,7 @@ static int linein_callback(int action,const struct menu_item_ex *this_item)
}
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 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#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 d072d4f881..ad93dc2681 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -595,7 +595,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
#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 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
return false;
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
static bool waiting_to_resume_play = false;
static long play_resume_tick;
@@ -774,7 +774,7 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
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 dd82a8da75..ebf048419b 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 @@ static const struct plugin_api rockbox_api = {
#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 daab88eda1..a48a65dfbb 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -510,7 +510,7 @@ struct plugin_api {
#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 4f1016b7eb..fff3c2fa57 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -156,11 +156,11 @@ bool exit_tsr(bool reenter)
/* 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 @@ void thread(void)
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 @@ void thread(void)
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 @@ void thread(void)
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 @@ void thread(void)
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 @@ void thread(void)
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 @@ void thread(void)
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 @@ int main(void)
"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 d74b7c193c..c7841c66b3 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -171,7 +171,7 @@ int mmc_remove_request(void)
}
#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 @@ bool quick_screen_f3(int button_enter)
#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 @@ bool view_runtime(void)
}
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 1a1a085ec7..8c51181ea0 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -665,7 +665,7 @@ void sound_settings_apply(void)
#endif
#ifdef HAVE_USB_POWER
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
usb_charging_enable(global_settings.usb_charging);
#endif
#endif
@@ -699,7 +699,7 @@ void settings_apply(void)
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 @@ void settings_apply(void)
#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 35eed906fb..af1d65d78f 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -629,7 +629,7 @@ struct user_settings
#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 37fa7c53c3..ee70e8c40b 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -415,7 +415,7 @@ const struct settings_list settings[] = {
"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 @@ const struct settings_list settings[] = {
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 @@ const struct settings_list settings[] = {
"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 @@ const struct settings_list settings[] = {
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 320e8f7e66..3074752add 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -742,7 +742,7 @@ static bool dirbrowse(void)
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 @@ static bool dirbrowse(void)
}
#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 d621aa42d1..99da3df0a8 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -116,7 +116,7 @@ static struct event_queue backlight_queue;
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 @@ static int backlight_on_button_hold = 0;
#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 @@ static void __remote_backlight_off(void)
/* 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 @@ static void backlight_update_state(void)
/* 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 @@ void backlight_thread(void)
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 @@ bool is_backlight_on(void)
/* 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 @@ void backlight_set_timeout(int index)
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 @@ void remote_backlight_set_timeout(int index)
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 @@ void remote_backlight_set_on_button_hold(int index)
/* 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 cab62f950c..5a40bdfde0 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -164,7 +164,7 @@ static void button_tick(void)
|| 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 872e8b0657..78e70f7466 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -83,7 +83,7 @@ void power_init(void)
}
-#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 0a59c0bf89..8283b37fc8 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 911ae1dd29..9eed1929fe 100644
--- a/firmware/export/power.h
+++ b/firmware/export/power.h
@@ -24,7 +24,7 @@ extern bool charger_enabled;
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 88fc5e8e33..a31acbcf0b 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -266,7 +266,7 @@ static const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
#endif
};
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
charger_input_state_type charger_input_state IDATA_ATTR;
@@ -545,7 +545,7 @@ static void battery_status_update(void)
/ 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 @@ static void handle_auto_poweroff(void)
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 @@ static void handle_auto_poweroff(void)
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 @@ static void power_thread_sleep(int ticks)
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 @@ static void power_thread_sleep(int ticks)
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 @@ static void power_thread(void)
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 7c95aaf200..3d726d0714 100644
--- a/firmware/target/coldfire/iriver/h300/power-h300.c
+++ b/firmware/target/coldfire/iriver/h300/power-h300.c
@@ -61,7 +61,7 @@ void power_init(void)
}
-#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 0a329ad624..ee08b04caa 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -492,7 +492,7 @@ bool usb_powered(void)
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 e3af78e721..9536d531f4 100644
--- a/flash/bootbox/main.c
+++ b/flash/bootbox/main.c
@@ -65,7 +65,7 @@ int show_logo(void)
return 0;
}
-#ifdef CONFIG_CHARGING
+#if CONFIG_CHARGING
/*
bool backlight_get_on_when_charging(void)
{
@@ -167,7 +167,7 @@ void main(void)
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 */