Do the CONFIG_LED define
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12383 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 4404776..d533e33 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -845,7 +845,7 @@
}
break;
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)) || defined(HAVE_REMOTE_LCD)
+#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
case 'l': /* VIRTUAL_LED */
{
switch(tag[1])
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index 805b6a0..f1bd58d 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -116,7 +116,7 @@
7*ICONS_SPACING
#define STATUSBAR_LOCKR_WIDTH 5
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)) || defined(HAVE_REMOTE_LCD)
+#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
#define STATUSBAR_DISK_WIDTH 12
#define STATUSBAR_DISK_X_POS(statusbar_width) statusbar_width - \
STATUSBAR_DISK_WIDTH
@@ -208,7 +208,7 @@
bar->info.repeat = global_settings.repeat_mode;
bar->info.playmode = current_playmode();
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)) || defined(HAVE_REMOTE_LCD)
+#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
if(!display->has_disk_led)
bar->info.led = led_read(HZ/2); /* delay should match polling interval */
#endif
@@ -300,7 +300,7 @@
#ifdef CONFIG_RTC
gui_statusbar_time(display, bar->info.hour, bar->info.minute);
#endif /* CONFIG_RTC */
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)) || defined(HAVE_REMOTE_LCD)
+#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
if(!display->has_disk_led && bar->info.led)
gui_statusbar_led(display);
#endif
@@ -541,7 +541,7 @@
}
#endif
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)) || defined(HAVE_REMOTE_LCD)
+#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
/*
* no real LED: disk activity in status bar
*/
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index 5190adc..516598d 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -52,7 +52,7 @@
#ifdef HAS_REMOTE_BUTTON_HOLD
bool keylockremote;
#endif
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)) || defined(HAVE_REMOTE_LCD)
+#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
bool led; /* disk LED simulation in the status bar */
#endif
diff --git a/apps/main.c b/apps/main.c
index 9a55be8..22eda84 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id$
*
- * Copyright (C) 2002 by Björn Stenberg
+ * Copyright (C) 2002 by Bj�n Stenberg
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
@@ -561,7 +561,7 @@
app_main();
while(1) {
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
led(true); sleep(HZ/10);
led(false); sleep(HZ/10);
#endif
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 729e032..bef1fa6 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -173,7 +173,7 @@
#ifdef CONFIG_RTC
extern void statusbar_time(int hour, int minute);
#endif
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)
+#if (CONFIG_LED == LED_VIRTUAL)
extern void statusbar_led(void);
#endif
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index d81b369..8eea24d 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -773,7 +773,7 @@
FMRADIO_OFF : get_radio_status();
#endif
int talk_menu = global_settings.talk_menu;
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
bool led_state = false;
int led_countdown = 2;
#endif
@@ -803,7 +803,7 @@
in_screen = true;
cursor = 0;
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
+#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
ata_set_led_enabled(false);
#endif
@@ -876,7 +876,7 @@
{
audio_stat = audio_status();
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
/*
* Flash the LED while waiting to record. Turn it on while
@@ -1188,7 +1188,7 @@
const int prev_rec_source = global_settings.rec_source;
#endif
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
/* led is restored at begin of loop / end of function */
led(false);
#endif
@@ -1251,7 +1251,7 @@
case ACTION_REC_F2:
if(audio_stat != AUDIO_STATUS_RECORD)
{
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
/* led is restored at begin of loop / end of function */
led(false);
#endif
@@ -1275,7 +1275,7 @@
{
if(audio_stat != AUDIO_STATUS_RECORD)
{
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
/* led is restored at begin of loop / end of function */
led(false);
#endif
@@ -1780,7 +1780,7 @@
if (have_recorded)
reload_directory();
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
+#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
ata_set_led_enabled(true);
#endif
return been_in_usb_mode;
diff --git a/apps/screen_access.c b/apps/screen_access.c
index f2e38e9..00db927 100644
--- a/apps/screen_access.c
+++ b/apps/screen_access.c
@@ -111,7 +111,7 @@
case SCREEN_MAIN:
default:
screen->depth=LCD_DEPTH;
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)
+#if (CONFIG_LED == LED_VIRTUAL)
screen->has_disk_led=false;
#elif defined(HAVE_REMOTE_LCD)
screen->has_disk_led=true;
diff --git a/apps/screen_access.h b/apps/screen_access.h
index befd7a6..54f2d64 100644
--- a/apps/screen_access.h
+++ b/apps/screen_access.h
@@ -54,7 +54,7 @@
int depth;
int char_width;
int char_height;
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)) || defined(HAVE_REMOTE_LCD)
+#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
bool has_disk_led;
#endif
#ifdef HAS_BUTTONBAR
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index c3c2531..54a1b12 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -71,7 +71,7 @@
int ata_device; /* device 0 (master) or 1 (slave) */
int ata_spinup_time = 0;
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
static bool ata_led_enabled = true;
static bool ata_led_on = false;
#endif
@@ -152,7 +152,7 @@
return (ATA_ALT_STATUS & (STATUS_RDY|STATUS_DRQ)) == STATUS_RDY;
}
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
/* Conditionally block LED access for the ATA driver, so the LED can be
* (mis)used for other purposes */
static void ata_led(bool on)
@@ -1003,7 +1003,7 @@
return 0;
}
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
void ata_set_led_enabled(bool enabled)
{
ata_led_enabled = enabled;
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c
index 2799b7c..36748a1 100644
--- a/firmware/drivers/led.c
+++ b/firmware/drivers/led.c
@@ -23,7 +23,7 @@
#include "system.h"
#include "kernel.h"
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_REAL))
+#if (CONFIG_LED == LED_REAL)
void led(bool on)
{
@@ -37,8 +37,7 @@
}
}
-#elif (defined(CONFIG_LED) && (CONFIG_LED == LED_VIRTUAL)) \
- || defined(HAVE_REMOTE_LCD)
+#elif (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
static bool current;
static long last_on; /* timestamp of switching off */
diff --git a/firmware/export/ata.h b/firmware/export/ata.h
index 697935c..d332330 100644
--- a/firmware/export/ata.h
+++ b/firmware/export/ata.h
@@ -47,7 +47,7 @@
extern int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf);
extern int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf);
extern void ata_spin(void);
-#if defined(CONFIG_LED) && (CONFIG_LED == LED_REAL)
+#if (CONFIG_LED == LED_REAL)
extern void ata_set_led_enabled(bool enabled);
#endif
extern unsigned short* ata_get_identify(void);
diff --git a/firmware/export/config.h b/firmware/export/config.h
index aaaac68..0a59c0b 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -226,6 +226,10 @@
#define CONFIG_USBOTG 0
#endif
+#ifndef CONFIG_LED
+#define CONFIG_LED 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/panic.c b/firmware/panic.c
index 8d6b0e5..c50bd54 100644
--- a/firmware/panic.c
+++ b/firmware/panic.c
@@ -39,7 +39,7 @@
va_list ap;
#ifndef SIMULATOR
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_REAL))
+#if (CONFIG_LED == LED_REAL)
bool state = false;
int i = 0;
#endif
@@ -90,7 +90,7 @@
while (1)
{
#ifndef SIMULATOR
-#if (defined(CONFIG_LED) && (CONFIG_LED == LED_REAL))
+#if (CONFIG_LED == LED_REAL)
if (--i <= 0)
{
state = !state;