summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-04-12 22:12:13 +0000
committerJens Arnold <amiconn@rockbox.org>2007-04-12 22:12:13 +0000
commit47bf6c5a5ad1fd9143ab87328793b285230f74a3 (patch)
tree5199f2225a3dfc438bb1c4c5e9906f14664dfa43
parent734278b7d1fde5e177c6842f49c16b9df8c353fa (diff)
downloadrockbox-47bf6c5a5ad1fd9143ab87328793b285230f74a3.tar.gz
rockbox-47bf6c5a5ad1fd9143ab87328793b285230f74a3.tar.bz2
rockbox-47bf6c5a5ad1fd9143ab87328793b285230f74a3.zip
Moved archos backlight code to target tree. Changed old mutlivalue CONFIG_BACKLIGHT to a simple HAVE_BACKLIGHT.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13136 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c2
-rw-r--r--apps/menus/display_menu.c10
-rw-r--r--apps/menus/recording_menu.c2
-rw-r--r--apps/plugins/jpeg.c4
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c4
-rw-r--r--apps/recorder/peakmeter.c6
-rw-r--r--apps/settings.c6
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_list.c20
-rw-r--r--firmware/backlight.c54
-rw-r--r--firmware/drivers/button.c16
-rw-r--r--firmware/export/backlight.h6
-rw-r--r--firmware/export/button.h2
-rw-r--r--firmware/export/config-e200.h3
-rw-r--r--firmware/export/config-fmrecorder.h2
-rw-r--r--firmware/export/config-gigabeat.h2
-rw-r--r--firmware/export/config-h10.h3
-rw-r--r--firmware/export/config-h100.h2
-rw-r--r--firmware/export/config-h10_5gb.h3
-rw-r--r--firmware/export/config-h120.h2
-rw-r--r--firmware/export/config-h300.h2
-rw-r--r--firmware/export/config-iaudiom5.h2
-rw-r--r--firmware/export/config-iaudiox5.h2
-rw-r--r--firmware/export/config-ifp7xx.h2
-rw-r--r--firmware/export/config-ipod3g.h2
-rw-r--r--firmware/export/config-ipod4g.h2
-rw-r--r--firmware/export/config-ipodcolor.h2
-rw-r--r--firmware/export/config-ipodmini.h2
-rw-r--r--firmware/export/config-ipodmini2g.h2
-rw-r--r--firmware/export/config-ipodnano.h2
-rw-r--r--firmware/export/config-ipodvideo.h2
-rw-r--r--firmware/export/config-ondiofm.h2
-rw-r--r--firmware/export/config-ondiosp.h2
-rw-r--r--firmware/export/config-player.h2
-rw-r--r--firmware/export/config-recorder.h2
-rw-r--r--firmware/export/config-recorderv2.h2
-rw-r--r--firmware/export/config-tpj1022.h3
-rw-r--r--firmware/export/config.h22
-rw-r--r--firmware/powermgmt.c2
-rw-r--r--firmware/target/arm/ipod/backlight-target.h1
-rw-r--r--firmware/target/arm/iriver/backlight-target.h1
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/backlight-target.h1
-rw-r--r--firmware/target/arm/tatung/tpj1022/backlight-target.h1
-rw-r--r--firmware/target/coldfire/iaudio/m5/backlight-target.h1
-rw-r--r--firmware/target/coldfire/iaudio/x5/backlight-target.h1
-rw-r--r--firmware/target/coldfire/iriver/backlight-target.h1
-rw-r--r--firmware/target/sh/archos/fm_v2/backlight-target.h39
-rw-r--r--firmware/target/sh/archos/ondio/backlight-target.h47
-rw-r--r--firmware/target/sh/archos/player/backlight-target.h44
-rw-r--r--firmware/target/sh/archos/recorder/backlight-target.h39
-rw-r--r--uisimulator/sdl/button.c10
-rw-r--r--uisimulator/sdl/lcd-bitmap.c8
-rw-r--r--uisimulator/sdl/lcd-charcells.c2
53 files changed, 256 insertions, 152 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index d0d46da837..6c58c1d666 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1901,7 +1901,7 @@ bool gui_wps_refresh(struct gui_wps *gwps,
display->update();
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
if (global_settings.caption_backlight && state->id3)
{
/* turn on backlight n seconds before track ends, and turn it off n
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index 0189749b18..660c68e996 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -38,7 +38,7 @@
#include "lcd-remote.h"
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
{
(void)this_item;
@@ -77,7 +77,7 @@ int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
/***********************************/
/* LCD MENU */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL);
#if CONFIG_CHARGING
MENUITEM_SETTING(backlight_timeout_plugged,
@@ -102,7 +102,7 @@ MENUITEM_SETTING(lcd_sleep_after_backlight_off,
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
MENUITEM_SETTING(brightness_item, &global_settings.brightness, NULL);
#endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_LCD_CONTRAST
MENUITEM_SETTING(contrast, &global_settings.contrast, NULL);
#endif
@@ -173,7 +173,7 @@ MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS),
/* now the actual menu */
MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
NULL, Icon_Display_menu
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
,&backlight_timeout
# if CONFIG_CHARGING
,&backlight_timeout_plugged
@@ -192,7 +192,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
# ifdef HAVE_BACKLIGHT_BRIGHTNESS
,&brightness_item
# endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_LCD_CONTRAST
,&contrast
#endif
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c
index 084ade0d33..1bc84e90d2 100644
--- a/apps/menus/recording_menu.c
+++ b/apps/menus/recording_menu.c
@@ -822,7 +822,7 @@ MAKE_MENU(recording_setting_menu, ID2P(LANG_RECORDING_SETTINGS), NULL, Icon_Reco
&filesplitoptionsmenu,
&rec_prerecord_time,
&recdirectory,
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
&cliplight,
#endif
&rectrigger_item,
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c
index a330748404..c31d45e8ab 100644
--- a/apps/plugins/jpeg.c
+++ b/apps/plugins/jpeg.c
@@ -3294,7 +3294,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
(actually it should also set the timeout when plugged in,
but the function backlight_set_timeout_plugged is not
available in plugins) */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);
#endif
@@ -3320,7 +3320,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->ata_spindown(rb->global_settings->disk_spindown);
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
/* reset backlight settings */
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
#endif
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 37723df7a6..b61e76ce8a 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -1645,7 +1645,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
(actually it should also set the timeout when plugged in,
but the function backlight_set_timeout_plugged is not
available in plugins) */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);
#endif
@@ -1778,7 +1778,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
save_settings(); /* Save settings (if they have changed) */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
/* reset backlight settings */
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
#endif
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 25e8ec47a8..f06b19ab2d 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -34,7 +34,7 @@
#include "peakmeter.h"
#include "audio.h"
#include "screen_access.h"
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#include "backlight.h"
#endif
#include "action.h"
@@ -1008,7 +1008,7 @@ void peak_meter_draw(struct screen *display, struct meter_scales *scales,
#ifdef HAVE_RECORDING
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
/* cliplight */
if ((pm_clip_left || pm_clip_right) &&
global_settings.cliplight &&
@@ -1032,7 +1032,7 @@ void peak_meter_draw(struct screen *display, struct meter_scales *scales,
}
#endif /* HAVE_REMOTE_LCD */
}
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
if (trig_status != TRIG_OFF) {
int start_trigx, stop_trigx, ycenter;
diff --git a/apps/settings.c b/apps/settings.c
index b6eb9a4f64..23b81173bd 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -699,7 +699,7 @@ void settings_apply(void)
remote_backlight_set_on_button_hold(global_settings.remote_backlight_on_button_hold);
#endif
#endif /* HAVE_REMOTE_LCD */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
backlight_set_timeout(global_settings.backlight_timeout);
#if CONFIG_CHARGING
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
@@ -836,7 +836,7 @@ void settings_apply(void)
spdif_power_enable(global_settings.spdif_enable);
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
#ifdef HAVE_REMOTE_LCD
set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
@@ -847,7 +847,7 @@ void settings_apply(void)
#ifdef HAVE_LCD_SLEEP
lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
#endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
/* This should stay last */
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
diff --git a/apps/settings.h b/apps/settings.h
index 9921feaba7..33dfb8546a 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -626,7 +626,7 @@ struct user_settings
#endif
bool party_mode; /* party mode - unstoppable music */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
bool bl_filter_first_keypress; /* filter first keypress when dark? */
#ifdef HAVE_REMOTE_LCD
bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */
@@ -639,7 +639,7 @@ struct user_settings
int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
has turned off */
#endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_LCD_BITMAP
unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 2b9457e1b0..3e4e3fb49a 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -107,7 +107,7 @@ static void rectime_formatter(char *buffer, int buffer_size,
#endif /* HAVE_RECORDING */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
static const char backlight_times_conf [] =
"off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90";
static const int backlight_times[] =
@@ -405,7 +405,7 @@ const struct settings_list settings[] = {
{ lcd_set_contrast, UNIT_INT, MIN_CONTRAST_SETTING,
MAX_CONTRAST_SETTING, 1, NULL, NULL}}}},
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
INT_SETTING_W_CFGVALS(F_FLIPLIST, backlight_timeout, LANG_BACKLIGHT, 6,
"backlight timeout", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang,
@@ -417,7 +417,7 @@ const struct settings_list settings[] = {
0, 18, 1, backlight_formatter, backlight_getlang,
backlight_set_timeout_plugged),
#endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_LCD_BITMAP
BOOL_SETTING(0, invert, LANG_INVERT, false ,"invert", off_on,
LANG_INVERT_LCD_INVERSE, LANG_INVERT_LCD_NORMAL, lcd_set_invert_display),
@@ -512,7 +512,7 @@ const struct settings_list settings[] = {
#endif
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
OFFON_SETTING(0,bl_filter_first_keypress,
LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS, false,
"backlight filters first keypress", NULL),
@@ -521,18 +521,18 @@ const struct settings_list settings[] = {
LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS, false,
"backlight filters first remote keypress", NULL),
#endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
/** End of old RTC config block **/
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
OFFON_SETTING(0,caption_backlight, LANG_CAPTION_BACKLIGHT,
false,"caption backlight",NULL),
#ifdef HAVE_REMOTE_LCD
OFFON_SETTING(0,remote_caption_backlight, LANG_CAPTION_BACKLIGHT,
false,"remote caption backlight",NULL),
#endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
INT_SETTING(0, brightness, LANG_BRIGHTNESS, DEFAULT_BRIGHTNESS_SETTING,
"brightness",UNIT_INT, MIN_BRIGHTNESS_SETTING, MAX_BRIGHTNESS_SETTING, 1,
@@ -759,7 +759,7 @@ const struct settings_list settings[] = {
UNIT_SEC, 0, 30, 1, rectime_formatter, rectime_getlang, NULL),
{F_T_INT,&global_settings.rec_directory,LANG_RECORD_DIRECTORY,
INT(0),"rec directory",REC_BASE_DIR ",current",UNUSED},
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
CHOICE_SETTING(0, cliplight, LANG_CLIP_LIGHT, 0 ,
"cliplight", "off,main,both,remote", NULL,
#ifdef HAVE_REMOTE_LCD
@@ -974,7 +974,7 @@ const struct settings_list settings[] = {
LANG_WARN_ERASEDYNPLAYLIST_MENU,false,
"warn when erasing dynamic playlist",NULL),
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAS_BUTTON_HOLD
CHOICE_SETTING(0, backlight_on_button_hold,
LANG_BACKLIGHT_ON_BUTTON_HOLD, 0, "backlight on button hold",
@@ -991,7 +991,7 @@ const struct settings_list settings[] = {
TALK_ID(15, UNIT_SEC), TALK_ID(20, UNIT_SEC), TALK_ID(30, UNIT_SEC),
TALK_ID(45, UNIT_SEC),TALK_ID(60, UNIT_SEC), TALK_ID(90, UNIT_SEC)),
#endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_WM8758
OFFON_SETTING(0,eq_hw_enabled,LANG_EQUALIZER_HARDWARE_ENABLED,false,
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 1ec8bf0933..8f5116b769 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -37,7 +37,7 @@
#ifdef HAVE_REMOTE_LCD
#include "lcd-remote.h"
#endif
-#if defined(TARGET_TREE) && !defined(SIMULATOR)
+#ifndef SIMULATOR
#include "backlight-target.h"
#endif
@@ -58,39 +58,9 @@ static inline void __backlight_set_brightness(int val)
(void)val;
}
#endif
-
-#else
-/* Basic low-level code that simply switches backlight on or off. Probably
- * a nice candidate for inclusion in the target/ dir. */
-#ifndef TARGET_TREE
-static inline void __backlight_on(void)
-{
-#if CONFIG_BACKLIGHT == BL_RTC
- /* Enable square wave */
- rtc_write(0x0a, rtc_read(0x0a) | 0x40);
-#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
- and_b(~0x40, &PADRH); /* drive and set low */
- or_b(0x40, &PAIORH);
-#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
- or_b(0x40, &PADRH); /* drive it high */
-#endif
-}
-
-static inline void __backlight_off(void)
-{
-#if CONFIG_BACKLIGHT == BL_RTC
- /* Disable square wave */
- rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
-#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
- and_b(~0x40, &PAIORH); /* let it float (up) */
-#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
- and_b(~0x40, &PADRH); /* drive it low */
-#endif
-}
-#endif
#endif /* SIMULATOR */
-#if CONFIG_BACKLIGHT && !defined(BOOTLOADER)
+#if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER)
const signed char backlight_timeout_value[19] =
{
@@ -558,23 +528,15 @@ void backlight_init(void)
queue_init(&backlight_queue, true);
queue_set_irq_safe(&backlight_queue, true);
-#ifdef SIMULATOR
- /* do nothing */
-#elif defined(__BACKLIGHT_INIT)
- /* Remove the __BACKLIGHT_INIT references when __backlight_init is
- available on all backlighted targets. Take them out of the
- backlight-target.h files as well */
+#ifndef SIMULATOR
if (__backlight_init())
{
-# if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
+# ifdef HAVE_BACKLIGHT_PWM_FADING
/* If backlight is already on, don't fade in. */
bl_dim_current = BL_PWM_COUNT;
bl_dim_target = BL_PWM_COUNT;
# endif
}
-#elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI
- PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
- or_b(0x40, &PAIORH); /* ..and output */
#endif
backlight_on();
#ifdef HAVE_REMOTE_LCD
@@ -806,16 +768,14 @@ void backlight_set_brightness(int val)
}
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
-#else /* (CONFIG_BACKLIGHT == 0) || defined(BOOTLOADER)
+#else /* !defined(HAVE_BACKLIGHT) || defined(BOOTLOADER)
-- no backlight, empty dummy functions */
-#if defined(BOOTLOADER) && CONFIG_BACKLIGHT
+#if defined(BOOTLOADER) && defined(HAVE_BACKLIGHT)
void backlight_init(void)
{
-#ifdef __BACKLIGHT_INIT
__backlight_init();
__backlight_on();
-#endif
}
#endif
@@ -832,4 +792,4 @@ bool is_remote_backlight_on(void) {return true;}
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
void backlight_set_brightness(int val) { (void)val; }
#endif
-#endif /* CONFIG_BACKLIGHT && !defined(BOOTLOADER) */
+#endif /* defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER) */
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 889c7a688d..b20afe13f6 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -52,12 +52,12 @@ static long last_read; /* Last button status, for debouncing/filtering */
#ifdef HAVE_LCD_BITMAP
static bool flipped; /* buttons can be flipped to match the LCD flip */
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
static bool filter_first_keypress;
#ifdef HAVE_REMOTE_LCD
static bool remote_filter_first_keypress;
#endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_HEADPHONE_DETECTION
bool phones_present = false;
#endif
@@ -80,7 +80,7 @@ static void button_tick(void)
static int repeat_count = 0;
static bool repeat = false;
static bool post = false;
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
static bool skip_release = false;
#ifdef HAVE_REMOTE_LCD
static bool skip_remote_release = false;
@@ -121,7 +121,7 @@ static void button_tick(void)
diff = btn ^ lastbtn;
if(diff && (btn & diff) == 0)
{
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
if(diff & BUTTON_REMOTE)
if(!skip_remote_release)
@@ -211,7 +211,7 @@ static void button_tick(void)
if (queue_empty(&button_queue))
{
queue_post(&button_queue, BUTTON_REPEAT | btn, 0);
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
skip_remote_release = false;
#endif
@@ -222,7 +222,7 @@ static void button_tick(void)
}
else
{
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
if (btn & BUTTON_REMOTE) {
if (!remote_filter_first_keypress || is_remote_backlight_on()
@@ -347,7 +347,7 @@ void button_init(void)
#ifdef HAVE_LCD_BITMAP
flipped = false;
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
filter_first_keypress = false;
#ifdef HAVE_REMOTE_LCD
remote_filter_first_keypress = false;
@@ -419,7 +419,7 @@ void button_set_flip(bool flip)
}
#endif /* HAVE_LCD_BITMAP */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
void set_backlight_filter_keypress(bool value)
{
filter_first_keypress = value;
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index 2873666dd8..4b164c63d2 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -26,7 +26,7 @@ void backlight_on(void);
void backlight_off(void);
void backlight_set_timeout(int index);
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
void backlight_init(void);
#if defined(IAUDIO_X5) && !defined(SIMULATOR)
@@ -54,9 +54,9 @@ void lcd_set_sleep_after_backlight_off(int index);
extern const signed char lcd_sleep_timeout_value[];
#endif
-#else /* CONFIG_BACKLIGHT == 0 */
+#else /* !HAVE_BACKLIGHT */
#define backlight_init()
-#endif /* CONFIG_BACKLIGHT */
+#endif /* !HAVE_BACKLIGHT */
#ifdef HAVE_REMOTE_LCD
void remote_backlight_on(void);
diff --git a/firmware/export/button.h b/firmware/export/button.h
index ea3effcaba..f675824c3d 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -33,7 +33,7 @@ void button_clear_queue(void);
#ifdef HAVE_LCD_BITMAP
void button_set_flip(bool flip); /* turn 180 degrees */
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
void set_backlight_filter_keypress(bool value);
#ifdef HAVE_REMOTE_LCD
void set_remote_backlight_filter_keypress(bool value);
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h
index efcb7ebfd5..ccff38dbf2 100644
--- a/firmware/export/config-e200.h
+++ b/firmware/export/config-e200.h
@@ -69,8 +69,7 @@
#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary
- because of 'target' stuff */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index e753808897..211dccb183 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -52,7 +52,7 @@
#define HAVE_SPDIF_IN
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
+#define HAVE_BACKLIGHT
#define CONFIG_I2C I2C_PLAYREC
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index 9b56a1a616..ef6d8243b8 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -42,7 +42,7 @@
#define CONFIG_RTC RTC_S3C2440
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_GIGABEAT /* port controlled PWM */
+#define HAVE_BACKLIGHT
#define HAVE_LCD_ENABLE
diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h
index 2b7f965294..4d372143f8 100644
--- a/firmware/export/config-h10.h
+++ b/firmware/export/config-h10.h
@@ -78,8 +78,7 @@
#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary
- because of 'target' stuff */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index dbb499f3af..cc2bfd7178 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -56,7 +56,7 @@
#define CONFIG_LCD LCD_S1D15E06
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h
index bbf3f2ffe6..3b3cebb8fb 100644
--- a/firmware/export/config-h10_5gb.h
+++ b/firmware/export/config-h10_5gb.h
@@ -72,8 +72,7 @@
#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary
- because of target tree stuff */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index f957f450d0..a0ad638fa2 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -51,7 +51,7 @@
#define CONFIG_LCD LCD_S1D15E06
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index ad80191885..0b2406bee7 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -51,7 +51,7 @@
#define HAVE_REMOTE_LCD
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IRIVER_H300 /* port controlled PWM */
+#define HAVE_BACKLIGHT
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h
index bce3c47e5c..bcc843f125 100644
--- a/firmware/export/config-iaudiom5.h
+++ b/firmware/export/config-iaudiom5.h
@@ -64,7 +64,7 @@
#define CONFIG_LCD LCD_S1D15E06
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_M5 /* PCF50606 I2C */
+#define HAVE_BACKLIGHT
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index 57f8a68134..43c02a0ee5 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -66,7 +66,7 @@
#define CONFIG_LCD LCD_X5
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_X5 /* PCF50606 I2C */
+#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
/* Define this if you have a software controlled poweroff */
diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h
index 1b0ea17984..435b6ef984 100644
--- a/firmware/export/config-ifp7xx.h
+++ b/firmware/export/config-ifp7xx.h
@@ -77,7 +77,7 @@
#define ROM_START 0x00000000
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IRIVER_IFP7XX /* port controlled */
+#define HAVE_BACKLIGHT
/* Define this to the CPU frequency */
#define CPU_FREQ 48000000
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h
index f3877cfdbc..ff91bcff49 100644
--- a/firmware/export/config-ipod3g.h
+++ b/firmware/export/config-ipod3g.h
@@ -64,7 +64,7 @@
#define HAVE_SW_TONE_CONTROLS
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPOD3G /* port controlled */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index ab172afd2e..4a8d4f1bf2 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -70,7 +70,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 5e3e5c3d62..41277041f1 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -61,7 +61,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index 40987d6b2c..7fba883c9c 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -67,7 +67,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index 80e2820339..55831c4cb3 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -67,7 +67,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index d32e45d17f..74bfe34d0f 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -61,7 +61,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index f9cc50d520..e10a7f9e55 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -61,7 +61,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h
index 0e691b70e3..c168ecf588 100644
--- a/firmware/export/config-ondiofm.h
+++ b/firmware/export/config-ondiofm.h
@@ -40,7 +40,7 @@
#define CONFIG_CODEC MAS3587F
/* Enable this if you have done the backlight mod */
-//#define CONFIG_BACKLIGHT BL_PA14_HI
+//#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h
index da723413ec..1d3e98ac0a 100644
--- a/firmware/export/config-ondiosp.h
+++ b/firmware/export/config-ondiosp.h
@@ -33,7 +33,7 @@
#define CONFIG_CODEC MAS3539F
/* Enable this if you have done the backlight mod */
-//#define CONFIG_BACKLIGHT BL_PA14_HI
+//#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h
index 580831c861..0256db137f 100644
--- a/firmware/export/config-player.h
+++ b/firmware/export/config-player.h
@@ -25,7 +25,7 @@
#define HAVE_DAC3550A
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h
index d8bd0bed2f..3fe7365d3c 100644
--- a/firmware/export/config-recorder.h
+++ b/firmware/export/config-recorder.h
@@ -46,7 +46,7 @@
#define HAVE_SPDIF_IN
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
+#define HAVE_BACKLIGHT
#define CONFIG_I2C I2C_PLAYREC
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index 0e6e00c167..8211994275 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -49,7 +49,7 @@
#define HAVE_SPDIF_IN
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
+#define HAVE_BACKLIGHT
#define CONFIG_I2C I2C_PLAYREC
diff --git a/firmware/export/config-tpj1022.h b/firmware/export/config-tpj1022.h
index 5837b0f01f..02e7319cfe 100644
--- a/firmware/export/config-tpj1022.h
+++ b/firmware/export/config-tpj1022.h
@@ -55,8 +55,7 @@
#define AB_REPEAT_ENABLE 1
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_TPJ1022 /* TODO: figure this out, probably not necessary
- because of 'target' stuff */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity
TODO: check this, probably different
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 2d7b3e131a..0ad94e06b1 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -113,24 +113,6 @@
#define RGB565 565
#define RGB565SWAPPED 3553
-/* CONFIG_BACKLIGHT */
-#define BL_PA14_LO 1 /* Player, PA14 low active */
-#define BL_RTC 2 /* Recorder, RTC square wave output */
-#define BL_PA14_HI 3 /* Ondio, PA14 high active */
-#define BL_IRIVER_H100 4 /* IRiver GPIO */
-#define BL_IPOD4G 5 /* Apple iPod 4G */
-#define BL_IPODNANO 6 /* Apple iPod Nano and iPod Video*/
-#define BL_IPOD3G 7 /* Apple iPod 3g with dock */
-#define BL_IRIVER_H300 8 /* IRiver PWM */
-#define BL_IRIVER_IFP7XX 9 /* IRiver GPIO */
-#define BL_IPODMINI 10 /* Apple iPod Mini */
-#define BL_GIGABEAT 11 /* Toshiba Gigabeat */
-#define BL_H10 12 /* iriver H10 */
-#define BL_X5 13 /* iAudio X5 PCF50606 I2C */
-#define BL_H10_5GB 14 /* iriver H10 5/6GB */
-#define BL_TPJ1022 15 /* Tatung Elio TPJ-1022 */
-#define BL_M5 16 /* iAudio M5 PCF50606 I2C */
-
/* CONFIG_I2C */
#define I2C_PLAYREC 1 /* Archos Player/Recorder style */
#define I2C_ONDIO 2 /* Ondio style */
@@ -235,10 +217,6 @@
#define CONFIG_LED 0
#endif
-#ifndef CONFIG_BACKLIGHT
-#define CONFIG_BACKLIGHT 0
-#endif
-
#ifndef CONFIG_CHARGING
#define CONFIG_CHARGING 0
#endif
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index e1ec1a6017..3d87773394 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -708,7 +708,7 @@ static int runcurrent(void)
current = CURRENT_USB;
}
-#if CONFIG_BACKLIGHT && !defined(BOOTLOADER)
+#if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER)
if (backlight_get_current_timeout() == 0) /* LED always on */
current += CURRENT_BACKLIGHT;
#endif
diff --git a/firmware/target/arm/ipod/backlight-target.h b/firmware/target/arm/ipod/backlight-target.h
index d35dccdc4a..f4e34cb53a 100644
--- a/firmware/target/arm/ipod/backlight-target.h
+++ b/firmware/target/arm/ipod/backlight-target.h
@@ -19,6 +19,7 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
+#define __backlight_init() true
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/arm/iriver/backlight-target.h b/firmware/target/arm/iriver/backlight-target.h
index d35dccdc4a..f4e34cb53a 100644
--- a/firmware/target/arm/iriver/backlight-target.h
+++ b/firmware/target/arm/iriver/backlight-target.h
@@ -19,6 +19,7 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
+#define __backlight_init() true
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/arm/sandisk/sansa-e200/backlight-target.h b/firmware/target/arm/sandisk/sansa-e200/backlight-target.h
index 5b96ae5e7e..16a02a4d11 100644
--- a/firmware/target/arm/sandisk/sansa-e200/backlight-target.h
+++ b/firmware/target/arm/sandisk/sansa-e200/backlight-target.h
@@ -19,6 +19,7 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
+#define __backlight_init() true
void __backlight_on(void);
void __backlight_off(void);
void __backlight_set_brightness(int brightness);
diff --git a/firmware/target/arm/tatung/tpj1022/backlight-target.h b/firmware/target/arm/tatung/tpj1022/backlight-target.h
index b5fe2f7c5d..079a8ce8aa 100644
--- a/firmware/target/arm/tatung/tpj1022/backlight-target.h
+++ b/firmware/target/arm/tatung/tpj1022/backlight-target.h
@@ -22,6 +22,7 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
+#define __backlight_init() true
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/coldfire/iaudio/m5/backlight-target.h b/firmware/target/coldfire/iaudio/m5/backlight-target.h
index d9c116803e..824810baa1 100644
--- a/firmware/target/coldfire/iaudio/m5/backlight-target.h
+++ b/firmware/target/coldfire/iaudio/m5/backlight-target.h
@@ -19,7 +19,6 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
-#define __BACKLIGHT_INIT
bool __backlight_init(void);
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/coldfire/iaudio/x5/backlight-target.h b/firmware/target/coldfire/iaudio/x5/backlight-target.h
index e70bea08e4..6e03aaa76f 100644
--- a/firmware/target/coldfire/iaudio/x5/backlight-target.h
+++ b/firmware/target/coldfire/iaudio/x5/backlight-target.h
@@ -19,7 +19,6 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
-#define __BACKLIGHT_INIT
bool __backlight_init(void);
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/coldfire/iriver/backlight-target.h b/firmware/target/coldfire/iriver/backlight-target.h
index e653fa1ffb..30a57e4fbc 100644
--- a/firmware/target/coldfire/iriver/backlight-target.h
+++ b/firmware/target/coldfire/iriver/backlight-target.h
@@ -19,7 +19,6 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
-#define __BACKLIGHT_INIT
bool __backlight_init(void); /* Returns backlight current state (true=ON). */
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/sh/archos/fm_v2/backlight-target.h b/firmware/target/sh/archos/fm_v2/backlight-target.h
new file mode 100644
index 0000000000..834d10bdc6
--- /dev/null
+++ b/firmware/target/sh/archos/fm_v2/backlight-target.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Jens Arnold
+ *
+ * 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.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+#include "config.h"
+#include "rtc.h"
+
+#define __backlight_init() true
+
+static inline void __backlight_on(void)
+{
+ /* Enable square wave */
+ rtc_write(0x0a, rtc_read(0x0a) | 0x40);
+}
+
+static inline void __backlight_off(void)
+{
+ /* Disable square wave */
+ rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
+}
+
+#endif
diff --git a/firmware/target/sh/archos/ondio/backlight-target.h b/firmware/target/sh/archos/ondio/backlight-target.h
new file mode 100644
index 0000000000..9be66bd6a0
--- /dev/null
+++ b/firmware/target/sh/archos/ondio/backlight-target.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Jens Arnold
+ *
+ * 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.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+#include "config.h"
+#include "cpu.h"
+
+#ifdef HAVE_BACKLIGHT
+/* A stock Ondio has no backlight, it needs a hardware mod. */
+
+static inline bool __backlight_init(void)
+{
+ PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
+ or_b(0x40, &PADRH); /* drive it high */
+ or_b(0x40, &PAIORH); /* ..and output */
+ return true;
+}
+
+static inline void __backlight_on(void)
+{
+ or_b(0x40, &PADRH); /* drive it high */
+}
+
+static inline void __backlight_off(void)
+{
+ and_b(~0x40, &PADRH); /* drive it low */
+}
+#endif /* HAVE_BACKLIGHT */
+
+#endif
diff --git a/firmware/target/sh/archos/player/backlight-target.h b/firmware/target/sh/archos/player/backlight-target.h
new file mode 100644
index 0000000000..d3bb7f39ed
--- /dev/null
+++ b/firmware/target/sh/archos/player/backlight-target.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Jens Arnold
+ *
+ * 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.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+#include "config.h"
+#include "cpu.h"
+
+static inline bool __backlight_init(void)
+{
+ PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
+ and_b(~0x40, &PADRH); /* drive and set low */
+ or_b(0x40, &PAIORH); /* ..and output */
+ return true;
+}
+
+static inline void __backlight_on(void)
+{
+ and_b(~0x40, &PADRH); /* drive and set low */
+ or_b(0x40, &PAIORH);
+}
+
+static inline void __backlight_off(void)
+{
+ and_b(~0x40, &PAIORH); /* let it float (up) */
+}
+
+#endif
diff --git a/firmware/target/sh/archos/recorder/backlight-target.h b/firmware/target/sh/archos/recorder/backlight-target.h
new file mode 100644
index 0000000000..834d10bdc6
--- /dev/null
+++ b/firmware/target/sh/archos/recorder/backlight-target.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Jens Arnold
+ *
+ * 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.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+#include "config.h"
+#include "rtc.h"
+
+#define __backlight_init() true
+
+static inline void __backlight_on(void)
+{
+ /* Enable square wave */
+ rtc_write(0x0a, rtc_read(0x0a) | 0x40);
+}
+
+static inline void __backlight_off(void)
+{
+ /* Disable square wave */
+ rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
+}
+
+#endif
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c
index 4b03008497..0c5f4f7d0b 100644
--- a/uisimulator/sdl/button.c
+++ b/uisimulator/sdl/button.c
@@ -49,7 +49,7 @@ struct event_queue button_queue;
static int btn = 0; /* Hopefully keeps track of currently pressed keys... */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
static bool filter_first_keypress;
void set_backlight_filter_keypress(bool value)
@@ -90,7 +90,7 @@ void button_event(int key, bool pressed)
static int repeat_count = 0;
static bool repeat = false;
static bool post = false;
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
static bool skip_release = false;
#ifdef HAVE_REMOTE_LCD
static bool skip_remote_release = false;
@@ -568,7 +568,7 @@ void button_event(int key, bool pressed)
diff = btn ^ lastbtn;
if(diff && (btn & diff) == 0)
{
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
if(diff & BUTTON_REMOTE)
if(!skip_remote_release)
@@ -635,7 +635,7 @@ void button_event(int key, bool pressed)
if (queue_empty(&button_queue))
{
queue_post(&button_queue, BUTTON_REPEAT | btn, 0);
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
if(btn & BUTTON_REMOTE)
{
@@ -652,7 +652,7 @@ void button_event(int key, bool pressed)
}
else
{
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
if (btn & BUTTON_REMOTE) {
if (!remote_filter_first_keypress || is_remote_backlight_on())
diff --git a/uisimulator/sdl/lcd-bitmap.c b/uisimulator/sdl/lcd-bitmap.c
index 3adb72b6d6..da6acce1bc 100644
--- a/uisimulator/sdl/lcd-bitmap.c
+++ b/uisimulator/sdl/lcd-bitmap.c
@@ -25,7 +25,7 @@ SDL_Surface* lcd_surface;
int lcd_backlight_val;
#if LCD_DEPTH <= 8
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0};
#endif
SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0};
@@ -71,7 +71,7 @@ void lcd_update_rect(int x_start, int y_start, int width, int height)
LCD_HEIGHT, background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0);
}
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
void sim_backlight(int value)
{
lcd_backlight_val = value;
@@ -116,7 +116,7 @@ void sim_lcd_init(void)
#endif
#if LCD_DEPTH <= 8
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max,
0, (1<<LCD_DEPTH));
#else
@@ -132,7 +132,7 @@ void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int))
lcd_ex_shades = shades;
lcd_ex_getpixel = getpixel;
if (shades) {
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
if (lcd_backlight_val > 0) {
sdl_set_gradient(lcd_surface, &lcd_color_max,
&lcd_backlight_color_zero, (1<<LCD_DEPTH),
diff --git a/uisimulator/sdl/lcd-charcells.c b/uisimulator/sdl/lcd-charcells.c
index 5a08179232..722933f002 100644
--- a/uisimulator/sdl/lcd-charcells.c
+++ b/uisimulator/sdl/lcd-charcells.c
@@ -71,7 +71,7 @@ void lcd_update(void)
LCD_HEIGHT*CHAR_HEIGHT*CHAR_PIXEL);
}
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
void sim_backlight(int value)
{
if (value > 0) {