summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,
1901 1901
1902 display->update(); 1902 display->update();
1903 1903
1904#if CONFIG_BACKLIGHT 1904#ifdef HAVE_BACKLIGHT
1905 if (global_settings.caption_backlight && state->id3) 1905 if (global_settings.caption_backlight && state->id3)
1906 { 1906 {
1907 /* turn on backlight n seconds before track ends, and turn it off n 1907 /* 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 @@
38#include "lcd-remote.h" 38#include "lcd-remote.h"
39 39
40 40
41#if CONFIG_BACKLIGHT 41#ifdef HAVE_BACKLIGHT
42int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) 42int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
43{ 43{
44 (void)this_item; 44 (void)this_item;
@@ -77,7 +77,7 @@ int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
77 77
78/***********************************/ 78/***********************************/
79/* LCD MENU */ 79/* LCD MENU */
80#if CONFIG_BACKLIGHT 80#ifdef HAVE_BACKLIGHT
81MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL); 81MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL);
82#if CONFIG_CHARGING 82#if CONFIG_CHARGING
83MENUITEM_SETTING(backlight_timeout_plugged, 83MENUITEM_SETTING(backlight_timeout_plugged,
@@ -102,7 +102,7 @@ MENUITEM_SETTING(lcd_sleep_after_backlight_off,
102#ifdef HAVE_BACKLIGHT_BRIGHTNESS 102#ifdef HAVE_BACKLIGHT_BRIGHTNESS
103MENUITEM_SETTING(brightness_item, &global_settings.brightness, NULL); 103MENUITEM_SETTING(brightness_item, &global_settings.brightness, NULL);
104#endif 104#endif
105#endif /* CONFIG_BACKLIGHT */ 105#endif /* HAVE_BACKLIGHT */
106#ifdef HAVE_LCD_CONTRAST 106#ifdef HAVE_LCD_CONTRAST
107MENUITEM_SETTING(contrast, &global_settings.contrast, NULL); 107MENUITEM_SETTING(contrast, &global_settings.contrast, NULL);
108#endif 108#endif
@@ -173,7 +173,7 @@ MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS),
173/* now the actual menu */ 173/* now the actual menu */
174MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU), 174MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
175 NULL, Icon_Display_menu 175 NULL, Icon_Display_menu
176#if CONFIG_BACKLIGHT 176#ifdef HAVE_BACKLIGHT
177 ,&backlight_timeout 177 ,&backlight_timeout
178# if CONFIG_CHARGING 178# if CONFIG_CHARGING
179 ,&backlight_timeout_plugged 179 ,&backlight_timeout_plugged
@@ -192,7 +192,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
192# ifdef HAVE_BACKLIGHT_BRIGHTNESS 192# ifdef HAVE_BACKLIGHT_BRIGHTNESS
193 ,&brightness_item 193 ,&brightness_item
194# endif 194# endif
195#endif /* CONFIG_BACKLIGHT */ 195#endif /* HAVE_BACKLIGHT */
196#ifdef HAVE_LCD_CONTRAST 196#ifdef HAVE_LCD_CONTRAST
197 ,&contrast 197 ,&contrast
198#endif 198#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
822 &filesplitoptionsmenu, 822 &filesplitoptionsmenu,
823 &rec_prerecord_time, 823 &rec_prerecord_time,
824 &recdirectory, 824 &recdirectory,
825#if CONFIG_BACKLIGHT 825#ifdef HAVE_BACKLIGHT
826 &cliplight, 826 &cliplight,
827#endif 827#endif
828 &rectrigger_item, 828 &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)
3294 (actually it should also set the timeout when plugged in, 3294 (actually it should also set the timeout when plugged in,
3295 but the function backlight_set_timeout_plugged is not 3295 but the function backlight_set_timeout_plugged is not
3296 available in plugins) */ 3296 available in plugins) */
3297#if CONFIG_BACKLIGHT 3297#ifdef HAVE_BACKLIGHT
3298 if (rb->global_settings->backlight_timeout > 0) 3298 if (rb->global_settings->backlight_timeout > 0)
3299 rb->backlight_set_timeout(1); 3299 rb->backlight_set_timeout(1);
3300#endif 3300#endif
@@ -3320,7 +3320,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
3320 rb->ata_spindown(rb->global_settings->disk_spindown); 3320 rb->ata_spindown(rb->global_settings->disk_spindown);
3321#endif 3321#endif
3322 3322
3323#if CONFIG_BACKLIGHT 3323#ifdef HAVE_BACKLIGHT
3324 /* reset backlight settings */ 3324 /* reset backlight settings */
3325 rb->backlight_set_timeout(rb->global_settings->backlight_timeout); 3325 rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
3326#endif 3326#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)
1645 (actually it should also set the timeout when plugged in, 1645 (actually it should also set the timeout when plugged in,
1646 but the function backlight_set_timeout_plugged is not 1646 but the function backlight_set_timeout_plugged is not
1647 available in plugins) */ 1647 available in plugins) */
1648#if CONFIG_BACKLIGHT 1648#ifdef HAVE_BACKLIGHT
1649 if (rb->global_settings->backlight_timeout > 0) 1649 if (rb->global_settings->backlight_timeout > 0)
1650 rb->backlight_set_timeout(1); 1650 rb->backlight_set_timeout(1);
1651#endif 1651#endif
@@ -1778,7 +1778,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1778 1778
1779 save_settings(); /* Save settings (if they have changed) */ 1779 save_settings(); /* Save settings (if they have changed) */
1780 1780
1781#if CONFIG_BACKLIGHT 1781#ifdef HAVE_BACKLIGHT
1782 /* reset backlight settings */ 1782 /* reset backlight settings */
1783 rb->backlight_set_timeout(rb->global_settings->backlight_timeout); 1783 rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
1784#endif 1784#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 @@
34#include "peakmeter.h" 34#include "peakmeter.h"
35#include "audio.h" 35#include "audio.h"
36#include "screen_access.h" 36#include "screen_access.h"
37#if CONFIG_BACKLIGHT 37#ifdef HAVE_BACKLIGHT
38#include "backlight.h" 38#include "backlight.h"
39#endif 39#endif
40#include "action.h" 40#include "action.h"
@@ -1008,7 +1008,7 @@ void peak_meter_draw(struct screen *display, struct meter_scales *scales,
1008 1008
1009#ifdef HAVE_RECORDING 1009#ifdef HAVE_RECORDING
1010 1010
1011#if CONFIG_BACKLIGHT 1011#ifdef HAVE_BACKLIGHT
1012 /* cliplight */ 1012 /* cliplight */
1013 if ((pm_clip_left || pm_clip_right) && 1013 if ((pm_clip_left || pm_clip_right) &&
1014 global_settings.cliplight && 1014 global_settings.cliplight &&
@@ -1032,7 +1032,7 @@ void peak_meter_draw(struct screen *display, struct meter_scales *scales,
1032 } 1032 }
1033#endif /* HAVE_REMOTE_LCD */ 1033#endif /* HAVE_REMOTE_LCD */
1034 } 1034 }
1035#endif /* CONFIG_BACKLIGHT */ 1035#endif /* HAVE_BACKLIGHT */
1036 1036
1037 if (trig_status != TRIG_OFF) { 1037 if (trig_status != TRIG_OFF) {
1038 int start_trigx, stop_trigx, ycenter; 1038 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)
699 remote_backlight_set_on_button_hold(global_settings.remote_backlight_on_button_hold); 699 remote_backlight_set_on_button_hold(global_settings.remote_backlight_on_button_hold);
700#endif 700#endif
701#endif /* HAVE_REMOTE_LCD */ 701#endif /* HAVE_REMOTE_LCD */
702#if CONFIG_BACKLIGHT 702#ifdef HAVE_BACKLIGHT
703 backlight_set_timeout(global_settings.backlight_timeout); 703 backlight_set_timeout(global_settings.backlight_timeout);
704#if CONFIG_CHARGING 704#if CONFIG_CHARGING
705 backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged); 705 backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
@@ -836,7 +836,7 @@ void settings_apply(void)
836 spdif_power_enable(global_settings.spdif_enable); 836 spdif_power_enable(global_settings.spdif_enable);
837#endif 837#endif
838 838
839#if CONFIG_BACKLIGHT 839#ifdef HAVE_BACKLIGHT
840 set_backlight_filter_keypress(global_settings.bl_filter_first_keypress); 840 set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
841#ifdef HAVE_REMOTE_LCD 841#ifdef HAVE_REMOTE_LCD
842 set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress); 842 set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
@@ -847,7 +847,7 @@ void settings_apply(void)
847#ifdef HAVE_LCD_SLEEP 847#ifdef HAVE_LCD_SLEEP
848 lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off); 848 lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
849#endif 849#endif
850#endif /* CONFIG_BACKLIGHT */ 850#endif /* HAVE_BACKLIGHT */
851 851
852 /* This should stay last */ 852 /* This should stay last */
853#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC 853#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
626#endif 626#endif
627 bool party_mode; /* party mode - unstoppable music */ 627 bool party_mode; /* party mode - unstoppable music */
628 628
629#if CONFIG_BACKLIGHT 629#ifdef HAVE_BACKLIGHT
630 bool bl_filter_first_keypress; /* filter first keypress when dark? */ 630 bool bl_filter_first_keypress; /* filter first keypress when dark? */
631#ifdef HAVE_REMOTE_LCD 631#ifdef HAVE_REMOTE_LCD
632 bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */ 632 bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */
@@ -639,7 +639,7 @@ struct user_settings
639 int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight 639 int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
640 has turned off */ 640 has turned off */
641#endif 641#endif
642#endif /* CONFIG_BACKLIGHT */ 642#endif /* HAVE_BACKLIGHT */
643 643
644#ifdef HAVE_LCD_BITMAP 644#ifdef HAVE_LCD_BITMAP
645 unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */ 645 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,
107 107
108#endif /* HAVE_RECORDING */ 108#endif /* HAVE_RECORDING */
109 109
110#if CONFIG_BACKLIGHT 110#ifdef HAVE_BACKLIGHT
111static const char backlight_times_conf [] = 111static const char backlight_times_conf [] =
112 "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90"; 112 "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90";
113static const int backlight_times[] = 113static const int backlight_times[] =
@@ -405,7 +405,7 @@ const struct settings_list settings[] = {
405 { lcd_set_contrast, UNIT_INT, MIN_CONTRAST_SETTING, 405 { lcd_set_contrast, UNIT_INT, MIN_CONTRAST_SETTING,
406 MAX_CONTRAST_SETTING, 1, NULL, NULL}}}}, 406 MAX_CONTRAST_SETTING, 1, NULL, NULL}}}},
407#endif 407#endif
408#if CONFIG_BACKLIGHT 408#ifdef HAVE_BACKLIGHT
409 INT_SETTING_W_CFGVALS(F_FLIPLIST, backlight_timeout, LANG_BACKLIGHT, 6, 409 INT_SETTING_W_CFGVALS(F_FLIPLIST, backlight_timeout, LANG_BACKLIGHT, 6,
410 "backlight timeout", backlight_times_conf, UNIT_SEC, 410 "backlight timeout", backlight_times_conf, UNIT_SEC,
411 0, 18, 1, backlight_formatter, backlight_getlang, 411 0, 18, 1, backlight_formatter, backlight_getlang,
@@ -417,7 +417,7 @@ const struct settings_list settings[] = {
417 0, 18, 1, backlight_formatter, backlight_getlang, 417 0, 18, 1, backlight_formatter, backlight_getlang,
418 backlight_set_timeout_plugged), 418 backlight_set_timeout_plugged),
419#endif 419#endif
420#endif /* CONFIG_BACKLIGHT */ 420#endif /* HAVE_BACKLIGHT */
421#ifdef HAVE_LCD_BITMAP 421#ifdef HAVE_LCD_BITMAP
422 BOOL_SETTING(0, invert, LANG_INVERT, false ,"invert", off_on, 422 BOOL_SETTING(0, invert, LANG_INVERT, false ,"invert", off_on,
423 LANG_INVERT_LCD_INVERSE, LANG_INVERT_LCD_NORMAL, lcd_set_invert_display), 423 LANG_INVERT_LCD_INVERSE, LANG_INVERT_LCD_NORMAL, lcd_set_invert_display),
@@ -512,7 +512,7 @@ const struct settings_list settings[] = {
512#endif 512#endif
513#endif 513#endif
514 514
515#if CONFIG_BACKLIGHT 515#ifdef HAVE_BACKLIGHT
516 OFFON_SETTING(0,bl_filter_first_keypress, 516 OFFON_SETTING(0,bl_filter_first_keypress,
517 LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS, false, 517 LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS, false,
518 "backlight filters first keypress", NULL), 518 "backlight filters first keypress", NULL),
@@ -521,18 +521,18 @@ const struct settings_list settings[] = {
521 LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS, false, 521 LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS, false,
522 "backlight filters first remote keypress", NULL), 522 "backlight filters first remote keypress", NULL),
523#endif 523#endif
524#endif /* CONFIG_BACKLIGHT */ 524#endif /* HAVE_BACKLIGHT */
525 525
526/** End of old RTC config block **/ 526/** End of old RTC config block **/
527 527
528#if CONFIG_BACKLIGHT 528#ifdef HAVE_BACKLIGHT
529 OFFON_SETTING(0,caption_backlight, LANG_CAPTION_BACKLIGHT, 529 OFFON_SETTING(0,caption_backlight, LANG_CAPTION_BACKLIGHT,
530 false,"caption backlight",NULL), 530 false,"caption backlight",NULL),
531#ifdef HAVE_REMOTE_LCD 531#ifdef HAVE_REMOTE_LCD
532 OFFON_SETTING(0,remote_caption_backlight, LANG_CAPTION_BACKLIGHT, 532 OFFON_SETTING(0,remote_caption_backlight, LANG_CAPTION_BACKLIGHT,
533 false,"remote caption backlight",NULL), 533 false,"remote caption backlight",NULL),
534#endif 534#endif
535#endif /* CONFIG_BACKLIGHT */ 535#endif /* HAVE_BACKLIGHT */
536#ifdef HAVE_BACKLIGHT_BRIGHTNESS 536#ifdef HAVE_BACKLIGHT_BRIGHTNESS
537 INT_SETTING(0, brightness, LANG_BRIGHTNESS, DEFAULT_BRIGHTNESS_SETTING, 537 INT_SETTING(0, brightness, LANG_BRIGHTNESS, DEFAULT_BRIGHTNESS_SETTING,
538 "brightness",UNIT_INT, MIN_BRIGHTNESS_SETTING, MAX_BRIGHTNESS_SETTING, 1, 538 "brightness",UNIT_INT, MIN_BRIGHTNESS_SETTING, MAX_BRIGHTNESS_SETTING, 1,
@@ -759,7 +759,7 @@ const struct settings_list settings[] = {
759 UNIT_SEC, 0, 30, 1, rectime_formatter, rectime_getlang, NULL), 759 UNIT_SEC, 0, 30, 1, rectime_formatter, rectime_getlang, NULL),
760 {F_T_INT,&global_settings.rec_directory,LANG_RECORD_DIRECTORY, 760 {F_T_INT,&global_settings.rec_directory,LANG_RECORD_DIRECTORY,
761 INT(0),"rec directory",REC_BASE_DIR ",current",UNUSED}, 761 INT(0),"rec directory",REC_BASE_DIR ",current",UNUSED},
762#if CONFIG_BACKLIGHT 762#ifdef HAVE_BACKLIGHT
763 CHOICE_SETTING(0, cliplight, LANG_CLIP_LIGHT, 0 , 763 CHOICE_SETTING(0, cliplight, LANG_CLIP_LIGHT, 0 ,
764 "cliplight", "off,main,both,remote", NULL, 764 "cliplight", "off,main,both,remote", NULL,
765#ifdef HAVE_REMOTE_LCD 765#ifdef HAVE_REMOTE_LCD
@@ -974,7 +974,7 @@ const struct settings_list settings[] = {
974 LANG_WARN_ERASEDYNPLAYLIST_MENU,false, 974 LANG_WARN_ERASEDYNPLAYLIST_MENU,false,
975 "warn when erasing dynamic playlist",NULL), 975 "warn when erasing dynamic playlist",NULL),
976 976
977#if CONFIG_BACKLIGHT 977#ifdef HAVE_BACKLIGHT
978#ifdef HAS_BUTTON_HOLD 978#ifdef HAS_BUTTON_HOLD
979 CHOICE_SETTING(0, backlight_on_button_hold, 979 CHOICE_SETTING(0, backlight_on_button_hold,
980 LANG_BACKLIGHT_ON_BUTTON_HOLD, 0, "backlight on button hold", 980 LANG_BACKLIGHT_ON_BUTTON_HOLD, 0, "backlight on button hold",
@@ -991,7 +991,7 @@ const struct settings_list settings[] = {
991 TALK_ID(15, UNIT_SEC), TALK_ID(20, UNIT_SEC), TALK_ID(30, UNIT_SEC), 991 TALK_ID(15, UNIT_SEC), TALK_ID(20, UNIT_SEC), TALK_ID(30, UNIT_SEC),
992 TALK_ID(45, UNIT_SEC),TALK_ID(60, UNIT_SEC), TALK_ID(90, UNIT_SEC)), 992 TALK_ID(45, UNIT_SEC),TALK_ID(60, UNIT_SEC), TALK_ID(90, UNIT_SEC)),
993#endif 993#endif
994#endif /* CONFIG_BACKLIGHT */ 994#endif /* HAVE_BACKLIGHT */
995 995
996#ifdef HAVE_WM8758 996#ifdef HAVE_WM8758
997 OFFON_SETTING(0,eq_hw_enabled,LANG_EQUALIZER_HARDWARE_ENABLED,false, 997 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 @@
37#ifdef HAVE_REMOTE_LCD 37#ifdef HAVE_REMOTE_LCD
38#include "lcd-remote.h" 38#include "lcd-remote.h"
39#endif 39#endif
40#if defined(TARGET_TREE) && !defined(SIMULATOR) 40#ifndef SIMULATOR
41#include "backlight-target.h" 41#include "backlight-target.h"
42#endif 42#endif
43 43
@@ -58,39 +58,9 @@ static inline void __backlight_set_brightness(int val)
58 (void)val; 58 (void)val;
59} 59}
60#endif 60#endif
61
62#else
63/* Basic low-level code that simply switches backlight on or off. Probably
64 * a nice candidate for inclusion in the target/ dir. */
65#ifndef TARGET_TREE
66static inline void __backlight_on(void)
67{
68#if CONFIG_BACKLIGHT == BL_RTC
69 /* Enable square wave */
70 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
71#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
72 and_b(~0x40, &PADRH); /* drive and set low */
73 or_b(0x40, &PAIORH);
74#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
75 or_b(0x40, &PADRH); /* drive it high */
76#endif
77}
78
79static inline void __backlight_off(void)
80{
81#if CONFIG_BACKLIGHT == BL_RTC
82 /* Disable square wave */
83 rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
84#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
85 and_b(~0x40, &PAIORH); /* let it float (up) */
86#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
87 and_b(~0x40, &PADRH); /* drive it low */
88#endif
89}
90#endif
91#endif /* SIMULATOR */ 61#endif /* SIMULATOR */
92 62
93#if CONFIG_BACKLIGHT && !defined(BOOTLOADER) 63#if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER)
94 64
95const signed char backlight_timeout_value[19] = 65const signed char backlight_timeout_value[19] =
96{ 66{
@@ -558,23 +528,15 @@ void backlight_init(void)
558 queue_init(&backlight_queue, true); 528 queue_init(&backlight_queue, true);
559 queue_set_irq_safe(&backlight_queue, true); 529 queue_set_irq_safe(&backlight_queue, true);
560 530
561#ifdef SIMULATOR 531#ifndef SIMULATOR
562 /* do nothing */
563#elif defined(__BACKLIGHT_INIT)
564 /* Remove the __BACKLIGHT_INIT references when __backlight_init is
565 available on all backlighted targets. Take them out of the
566 backlight-target.h files as well */
567 if (__backlight_init()) 532 if (__backlight_init())
568 { 533 {
569# if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) 534# ifdef HAVE_BACKLIGHT_PWM_FADING
570 /* If backlight is already on, don't fade in. */ 535 /* If backlight is already on, don't fade in. */
571 bl_dim_current = BL_PWM_COUNT; 536 bl_dim_current = BL_PWM_COUNT;
572 bl_dim_target = BL_PWM_COUNT; 537 bl_dim_target = BL_PWM_COUNT;
573# endif 538# endif
574 } 539 }
575#elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI
576 PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
577 or_b(0x40, &PAIORH); /* ..and output */
578#endif 540#endif
579 backlight_on(); 541 backlight_on();
580#ifdef HAVE_REMOTE_LCD 542#ifdef HAVE_REMOTE_LCD
@@ -806,16 +768,14 @@ void backlight_set_brightness(int val)
806} 768}
807#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ 769#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
808 770
809#else /* (CONFIG_BACKLIGHT == 0) || defined(BOOTLOADER) 771#else /* !defined(HAVE_BACKLIGHT) || defined(BOOTLOADER)
810 -- no backlight, empty dummy functions */ 772 -- no backlight, empty dummy functions */
811 773
812#if defined(BOOTLOADER) && CONFIG_BACKLIGHT 774#if defined(BOOTLOADER) && defined(HAVE_BACKLIGHT)
813void backlight_init(void) 775void backlight_init(void)
814{ 776{
815#ifdef __BACKLIGHT_INIT
816 __backlight_init(); 777 __backlight_init();
817 __backlight_on(); 778 __backlight_on();
818#endif
819} 779}
820#endif 780#endif
821 781
@@ -832,4 +792,4 @@ bool is_remote_backlight_on(void) {return true;}
832#ifdef HAVE_BACKLIGHT_BRIGHTNESS 792#ifdef HAVE_BACKLIGHT_BRIGHTNESS
833void backlight_set_brightness(int val) { (void)val; } 793void backlight_set_brightness(int val) { (void)val; }
834#endif 794#endif
835#endif /* CONFIG_BACKLIGHT && !defined(BOOTLOADER) */ 795#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 */
52#ifdef HAVE_LCD_BITMAP 52#ifdef HAVE_LCD_BITMAP
53static bool flipped; /* buttons can be flipped to match the LCD flip */ 53static bool flipped; /* buttons can be flipped to match the LCD flip */
54#endif 54#endif
55#if CONFIG_BACKLIGHT 55#ifdef HAVE_BACKLIGHT
56static bool filter_first_keypress; 56static bool filter_first_keypress;
57#ifdef HAVE_REMOTE_LCD 57#ifdef HAVE_REMOTE_LCD
58static bool remote_filter_first_keypress; 58static bool remote_filter_first_keypress;
59#endif 59#endif
60#endif /* CONFIG_BACKLIGHT */ 60#endif /* HAVE_BACKLIGHT */
61#ifdef HAVE_HEADPHONE_DETECTION 61#ifdef HAVE_HEADPHONE_DETECTION
62bool phones_present = false; 62bool phones_present = false;
63#endif 63#endif
@@ -80,7 +80,7 @@ static void button_tick(void)
80 static int repeat_count = 0; 80 static int repeat_count = 0;
81 static bool repeat = false; 81 static bool repeat = false;
82 static bool post = false; 82 static bool post = false;
83#if CONFIG_BACKLIGHT 83#ifdef HAVE_BACKLIGHT
84 static bool skip_release = false; 84 static bool skip_release = false;
85#ifdef HAVE_REMOTE_LCD 85#ifdef HAVE_REMOTE_LCD
86 static bool skip_remote_release = false; 86 static bool skip_remote_release = false;
@@ -121,7 +121,7 @@ static void button_tick(void)
121 diff = btn ^ lastbtn; 121 diff = btn ^ lastbtn;
122 if(diff && (btn & diff) == 0) 122 if(diff && (btn & diff) == 0)
123 { 123 {
124#if CONFIG_BACKLIGHT 124#ifdef HAVE_BACKLIGHT
125#ifdef HAVE_REMOTE_LCD 125#ifdef HAVE_REMOTE_LCD
126 if(diff & BUTTON_REMOTE) 126 if(diff & BUTTON_REMOTE)
127 if(!skip_remote_release) 127 if(!skip_remote_release)
@@ -211,7 +211,7 @@ static void button_tick(void)
211 if (queue_empty(&button_queue)) 211 if (queue_empty(&button_queue))
212 { 212 {
213 queue_post(&button_queue, BUTTON_REPEAT | btn, 0); 213 queue_post(&button_queue, BUTTON_REPEAT | btn, 0);
214#if CONFIG_BACKLIGHT 214#ifdef HAVE_BACKLIGHT
215#ifdef HAVE_REMOTE_LCD 215#ifdef HAVE_REMOTE_LCD
216 skip_remote_release = false; 216 skip_remote_release = false;
217#endif 217#endif
@@ -222,7 +222,7 @@ static void button_tick(void)
222 } 222 }
223 else 223 else
224 { 224 {
225#if CONFIG_BACKLIGHT 225#ifdef HAVE_BACKLIGHT
226#ifdef HAVE_REMOTE_LCD 226#ifdef HAVE_REMOTE_LCD
227 if (btn & BUTTON_REMOTE) { 227 if (btn & BUTTON_REMOTE) {
228 if (!remote_filter_first_keypress || is_remote_backlight_on() 228 if (!remote_filter_first_keypress || is_remote_backlight_on()
@@ -347,7 +347,7 @@ void button_init(void)
347#ifdef HAVE_LCD_BITMAP 347#ifdef HAVE_LCD_BITMAP
348 flipped = false; 348 flipped = false;
349#endif 349#endif
350#if CONFIG_BACKLIGHT 350#ifdef HAVE_BACKLIGHT
351 filter_first_keypress = false; 351 filter_first_keypress = false;
352#ifdef HAVE_REMOTE_LCD 352#ifdef HAVE_REMOTE_LCD
353 remote_filter_first_keypress = false; 353 remote_filter_first_keypress = false;
@@ -419,7 +419,7 @@ void button_set_flip(bool flip)
419} 419}
420#endif /* HAVE_LCD_BITMAP */ 420#endif /* HAVE_LCD_BITMAP */
421 421
422#if CONFIG_BACKLIGHT 422#ifdef HAVE_BACKLIGHT
423void set_backlight_filter_keypress(bool value) 423void set_backlight_filter_keypress(bool value)
424{ 424{
425 filter_first_keypress = value; 425 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);
26void backlight_off(void); 26void backlight_off(void);
27void backlight_set_timeout(int index); 27void backlight_set_timeout(int index);
28 28
29#if CONFIG_BACKLIGHT 29#ifdef HAVE_BACKLIGHT
30void backlight_init(void); 30void backlight_init(void);
31 31
32#if defined(IAUDIO_X5) && !defined(SIMULATOR) 32#if defined(IAUDIO_X5) && !defined(SIMULATOR)
@@ -54,9 +54,9 @@ void lcd_set_sleep_after_backlight_off(int index);
54extern const signed char lcd_sleep_timeout_value[]; 54extern const signed char lcd_sleep_timeout_value[];
55#endif 55#endif
56 56
57#else /* CONFIG_BACKLIGHT == 0 */ 57#else /* !HAVE_BACKLIGHT */
58#define backlight_init() 58#define backlight_init()
59#endif /* CONFIG_BACKLIGHT */ 59#endif /* !HAVE_BACKLIGHT */
60 60
61#ifdef HAVE_REMOTE_LCD 61#ifdef HAVE_REMOTE_LCD
62void remote_backlight_on(void); 62void 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);
33#ifdef HAVE_LCD_BITMAP 33#ifdef HAVE_LCD_BITMAP
34void button_set_flip(bool flip); /* turn 180 degrees */ 34void button_set_flip(bool flip); /* turn 180 degrees */
35#endif 35#endif
36#if CONFIG_BACKLIGHT 36#ifdef HAVE_BACKLIGHT
37void set_backlight_filter_keypress(bool value); 37void set_backlight_filter_keypress(bool value);
38#ifdef HAVE_REMOTE_LCD 38#ifdef HAVE_REMOTE_LCD
39void set_remote_backlight_filter_keypress(bool value); 39void 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 @@
69#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */ 69#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */
70 70
71/* Define this for LCD backlight available */ 71/* Define this for LCD backlight available */
72#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary 72#define HAVE_BACKLIGHT
73 because of 'target' stuff */
74 73
75#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ 74#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */
76 75
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 @@
52#define HAVE_SPDIF_IN 52#define HAVE_SPDIF_IN
53 53
54/* Define this for LCD backlight available */ 54/* Define this for LCD backlight available */
55#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ 55#define HAVE_BACKLIGHT
56 56
57#define CONFIG_I2C I2C_PLAYREC 57#define CONFIG_I2C I2C_PLAYREC
58 58
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 @@
42#define CONFIG_RTC RTC_S3C2440 42#define CONFIG_RTC RTC_S3C2440
43 43
44/* Define this for LCD backlight available */ 44/* Define this for LCD backlight available */
45#define CONFIG_BACKLIGHT BL_GIGABEAT /* port controlled PWM */ 45#define HAVE_BACKLIGHT
46 46
47#define HAVE_LCD_ENABLE 47#define HAVE_LCD_ENABLE
48 48
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 @@
78#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */ 78#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */
79 79
80/* Define this for LCD backlight available */ 80/* Define this for LCD backlight available */
81#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary 81#define HAVE_BACKLIGHT
82 because of 'target' stuff */
83 82
84#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ 83#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */
85 84
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 @@
56#define CONFIG_LCD LCD_S1D15E06 56#define CONFIG_LCD LCD_S1D15E06
57 57
58/* Define this for LCD backlight available */ 58/* Define this for LCD backlight available */
59#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */ 59#define HAVE_BACKLIGHT
60 60
61/* We can fade the backlight by using PWM */ 61/* We can fade the backlight by using PWM */
62#define HAVE_BACKLIGHT_PWM_FADING 62#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 @@
72#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */ 72#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */
73 73
74/* Define this for LCD backlight available */ 74/* Define this for LCD backlight available */
75#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary 75#define HAVE_BACKLIGHT
76 because of target tree stuff */
77 76
78#define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */ 77#define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */
79 78
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 @@
51#define CONFIG_LCD LCD_S1D15E06 51#define CONFIG_LCD LCD_S1D15E06
52 52
53/* Define this for LCD backlight available */ 53/* Define this for LCD backlight available */
54#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */ 54#define HAVE_BACKLIGHT
55 55
56/* We can fade the backlight by using PWM */ 56/* We can fade the backlight by using PWM */
57#define HAVE_BACKLIGHT_PWM_FADING 57#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 @@
51#define HAVE_REMOTE_LCD 51#define HAVE_REMOTE_LCD
52 52
53/* Define this for LCD backlight available */ 53/* Define this for LCD backlight available */
54#define CONFIG_BACKLIGHT BL_IRIVER_H300 /* port controlled PWM */ 54#define HAVE_BACKLIGHT
55 55
56/* Define this if you have a software controlled poweroff */ 56/* Define this if you have a software controlled poweroff */
57#define HAVE_SW_POWEROFF 57#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 @@
64#define CONFIG_LCD LCD_S1D15E06 64#define CONFIG_LCD LCD_S1D15E06
65 65
66/* Define this for LCD backlight available */ 66/* Define this for LCD backlight available */
67#define CONFIG_BACKLIGHT BL_M5 /* PCF50606 I2C */ 67#define HAVE_BACKLIGHT
68 68
69/* Define this if you have a software controlled poweroff */ 69/* Define this if you have a software controlled poweroff */
70#define HAVE_SW_POWEROFF 70#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 @@
66#define CONFIG_LCD LCD_X5 66#define CONFIG_LCD LCD_X5
67 67
68/* Define this for LCD backlight available */ 68/* Define this for LCD backlight available */
69#define CONFIG_BACKLIGHT BL_X5 /* PCF50606 I2C */ 69#define HAVE_BACKLIGHT
70#define HAVE_BACKLIGHT_BRIGHTNESS 70#define HAVE_BACKLIGHT_BRIGHTNESS
71 71
72/* Define this if you have a software controlled poweroff */ 72/* 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 @@
77#define ROM_START 0x00000000 77#define ROM_START 0x00000000
78 78
79/* Define this for LCD backlight available */ 79/* Define this for LCD backlight available */
80#define CONFIG_BACKLIGHT BL_IRIVER_IFP7XX /* port controlled */ 80#define HAVE_BACKLIGHT
81 81
82/* Define this to the CPU frequency */ 82/* Define this to the CPU frequency */
83#define CPU_FREQ 48000000 83#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 @@
64#define HAVE_SW_TONE_CONTROLS 64#define HAVE_SW_TONE_CONTROLS
65 65
66/* Define this for LCD backlight available */ 66/* Define this for LCD backlight available */
67#define CONFIG_BACKLIGHT BL_IPOD3G /* port controlled */ 67#define HAVE_BACKLIGHT
68 68
69#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ 69#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
70 70
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 @@
70#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE 70#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
71 71
72/* Define this for LCD backlight available */ 72/* Define this for LCD backlight available */
73#define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ 73#define HAVE_BACKLIGHT
74 74
75#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ 75#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
76 76
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 @@
61#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE 61#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
62 62
63/* Define this for LCD backlight available */ 63/* Define this for LCD backlight available */
64#define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ 64#define HAVE_BACKLIGHT
65 65
66#define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */ 66#define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */
67 67
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 @@
67#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE 67#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
68 68
69/* Define this for LCD backlight available */ 69/* Define this for LCD backlight available */
70#define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */ 70#define HAVE_BACKLIGHT
71 71
72#define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ 72#define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */
73 73
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 @@
67#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE 67#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
68 68
69/* Define this for LCD backlight available */ 69/* Define this for LCD backlight available */
70#define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */ 70#define HAVE_BACKLIGHT
71 71
72/* We can fade the backlight by using PWM */ 72/* We can fade the backlight by using PWM */
73#define HAVE_BACKLIGHT_PWM_FADING 73#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 @@
61#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE 61#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
62 62
63/* Define this for LCD backlight available */ 63/* Define this for LCD backlight available */
64#define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */ 64#define HAVE_BACKLIGHT
65 65
66/* We can fade the backlight by using PWM */ 66/* We can fade the backlight by using PWM */
67#define HAVE_BACKLIGHT_PWM_FADING 67#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 @@
61#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE 61#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
62 62
63/* Define this for LCD backlight available */ 63/* Define this for LCD backlight available */
64#define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */ 64#define HAVE_BACKLIGHT
65 65
66/* We can fade the backlight by using PWM */ 66/* We can fade the backlight by using PWM */
67#define HAVE_BACKLIGHT_PWM_FADING 67#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 @@
40#define CONFIG_CODEC MAS3587F 40#define CONFIG_CODEC MAS3587F
41 41
42/* Enable this if you have done the backlight mod */ 42/* Enable this if you have done the backlight mod */
43//#define CONFIG_BACKLIGHT BL_PA14_HI 43//#define HAVE_BACKLIGHT
44 44
45#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ 45#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
46 46
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 @@
33#define CONFIG_CODEC MAS3539F 33#define CONFIG_CODEC MAS3539F
34 34
35/* Enable this if you have done the backlight mod */ 35/* Enable this if you have done the backlight mod */
36//#define CONFIG_BACKLIGHT BL_PA14_HI 36//#define HAVE_BACKLIGHT
37 37
38#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ 38#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
39 39
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 @@
25#define HAVE_DAC3550A 25#define HAVE_DAC3550A
26 26
27/* Define this for LCD backlight available */ 27/* Define this for LCD backlight available */
28#define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */ 28#define HAVE_BACKLIGHT
29 29
30#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ 30#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
31 31
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 @@
46#define HAVE_SPDIF_IN 46#define HAVE_SPDIF_IN
47 47
48/* Define this for LCD backlight available */ 48/* Define this for LCD backlight available */
49#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ 49#define HAVE_BACKLIGHT
50 50
51#define CONFIG_I2C I2C_PLAYREC 51#define CONFIG_I2C I2C_PLAYREC
52 52
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 @@
49#define HAVE_SPDIF_IN 49#define HAVE_SPDIF_IN
50 50
51/* Define this for LCD backlight available */ 51/* Define this for LCD backlight available */
52#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ 52#define HAVE_BACKLIGHT
53 53
54#define CONFIG_I2C I2C_PLAYREC 54#define CONFIG_I2C I2C_PLAYREC
55 55
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 @@
55#define AB_REPEAT_ENABLE 1 55#define AB_REPEAT_ENABLE 1
56 56
57/* Define this for LCD backlight available */ 57/* Define this for LCD backlight available */
58#define CONFIG_BACKLIGHT BL_TPJ1022 /* TODO: figure this out, probably not necessary 58#define HAVE_BACKLIGHT
59 because of 'target' stuff */
60 59
61#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity 60#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity
62 TODO: check this, probably different 61 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 @@
113#define RGB565 565 113#define RGB565 565
114#define RGB565SWAPPED 3553 114#define RGB565SWAPPED 3553
115 115
116/* CONFIG_BACKLIGHT */
117#define BL_PA14_LO 1 /* Player, PA14 low active */
118#define BL_RTC 2 /* Recorder, RTC square wave output */
119#define BL_PA14_HI 3 /* Ondio, PA14 high active */
120#define BL_IRIVER_H100 4 /* IRiver GPIO */
121#define BL_IPOD4G 5 /* Apple iPod 4G */
122#define BL_IPODNANO 6 /* Apple iPod Nano and iPod Video*/
123#define BL_IPOD3G 7 /* Apple iPod 3g with dock */
124#define BL_IRIVER_H300 8 /* IRiver PWM */
125#define BL_IRIVER_IFP7XX 9 /* IRiver GPIO */
126#define BL_IPODMINI 10 /* Apple iPod Mini */
127#define BL_GIGABEAT 11 /* Toshiba Gigabeat */
128#define BL_H10 12 /* iriver H10 */
129#define BL_X5 13 /* iAudio X5 PCF50606 I2C */
130#define BL_H10_5GB 14 /* iriver H10 5/6GB */
131#define BL_TPJ1022 15 /* Tatung Elio TPJ-1022 */
132#define BL_M5 16 /* iAudio M5 PCF50606 I2C */
133
134/* CONFIG_I2C */ 116/* CONFIG_I2C */
135#define I2C_PLAYREC 1 /* Archos Player/Recorder style */ 117#define I2C_PLAYREC 1 /* Archos Player/Recorder style */
136#define I2C_ONDIO 2 /* Ondio style */ 118#define I2C_ONDIO 2 /* Ondio style */
@@ -235,10 +217,6 @@
235#define CONFIG_LED 0 217#define CONFIG_LED 0
236#endif 218#endif
237 219
238#ifndef CONFIG_BACKLIGHT
239#define CONFIG_BACKLIGHT 0
240#endif
241
242#ifndef CONFIG_CHARGING 220#ifndef CONFIG_CHARGING
243#define CONFIG_CHARGING 0 221#define CONFIG_CHARGING 0
244#endif 222#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)
708 current = CURRENT_USB; 708 current = CURRENT_USB;
709 } 709 }
710 710
711#if CONFIG_BACKLIGHT && !defined(BOOTLOADER) 711#if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER)
712 if (backlight_get_current_timeout() == 0) /* LED always on */ 712 if (backlight_get_current_timeout() == 0) /* LED always on */
713 current += CURRENT_BACKLIGHT; 713 current += CURRENT_BACKLIGHT;
714#endif 714#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 @@
19#ifndef BACKLIGHT_TARGET_H 19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H 20#define BACKLIGHT_TARGET_H
21 21
22#define __backlight_init() true
22void __backlight_on(void); 23void __backlight_on(void);
23void __backlight_off(void); 24void __backlight_off(void);
24 25
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 @@
19#ifndef BACKLIGHT_TARGET_H 19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H 20#define BACKLIGHT_TARGET_H
21 21
22#define __backlight_init() true
22void __backlight_on(void); 23void __backlight_on(void);
23void __backlight_off(void); 24void __backlight_off(void);
24 25
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 @@
19#ifndef BACKLIGHT_TARGET_H 19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H 20#define BACKLIGHT_TARGET_H
21 21
22#define __backlight_init() true
22void __backlight_on(void); 23void __backlight_on(void);
23void __backlight_off(void); 24void __backlight_off(void);
24void __backlight_set_brightness(int brightness); 25void __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 @@
22#ifndef BACKLIGHT_TARGET_H 22#ifndef BACKLIGHT_TARGET_H
23#define BACKLIGHT_TARGET_H 23#define BACKLIGHT_TARGET_H
24 24
25#define __backlight_init() true
25void __backlight_on(void); 26void __backlight_on(void);
26void __backlight_off(void); 27void __backlight_off(void);
27 28
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 @@
19#ifndef BACKLIGHT_TARGET_H 19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H 20#define BACKLIGHT_TARGET_H
21 21
22#define __BACKLIGHT_INIT
23bool __backlight_init(void); 22bool __backlight_init(void);
24void __backlight_on(void); 23void __backlight_on(void);
25void __backlight_off(void); 24void __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 @@
19#ifndef BACKLIGHT_TARGET_H 19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H 20#define BACKLIGHT_TARGET_H
21 21
22#define __BACKLIGHT_INIT
23bool __backlight_init(void); 22bool __backlight_init(void);
24void __backlight_on(void); 23void __backlight_on(void);
25void __backlight_off(void); 24void __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 @@
19#ifndef BACKLIGHT_TARGET_H 19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H 20#define BACKLIGHT_TARGET_H
21 21
22#define __BACKLIGHT_INIT
23bool __backlight_init(void); /* Returns backlight current state (true=ON). */ 22bool __backlight_init(void); /* Returns backlight current state (true=ON). */
24void __backlight_on(void); 23void __backlight_on(void);
25void __backlight_off(void); 24void __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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Jens Arnold
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H
21
22#include "config.h"
23#include "rtc.h"
24
25#define __backlight_init() true
26
27static inline void __backlight_on(void)
28{
29 /* Enable square wave */
30 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
31}
32
33static inline void __backlight_off(void)
34{
35 /* Disable square wave */
36 rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
37}
38
39#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Jens Arnold
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H
21
22#include "config.h"
23#include "cpu.h"
24
25#ifdef HAVE_BACKLIGHT
26/* A stock Ondio has no backlight, it needs a hardware mod. */
27
28static inline bool __backlight_init(void)
29{
30 PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
31 or_b(0x40, &PADRH); /* drive it high */
32 or_b(0x40, &PAIORH); /* ..and output */
33 return true;
34}
35
36static inline void __backlight_on(void)
37{
38 or_b(0x40, &PADRH); /* drive it high */
39}
40
41static inline void __backlight_off(void)
42{
43 and_b(~0x40, &PADRH); /* drive it low */
44}
45#endif /* HAVE_BACKLIGHT */
46
47#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Jens Arnold
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H
21
22#include "config.h"
23#include "cpu.h"
24
25static inline bool __backlight_init(void)
26{
27 PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
28 and_b(~0x40, &PADRH); /* drive and set low */
29 or_b(0x40, &PAIORH); /* ..and output */
30 return true;
31}
32
33static inline void __backlight_on(void)
34{
35 and_b(~0x40, &PADRH); /* drive and set low */
36 or_b(0x40, &PAIORH);
37}
38
39static inline void __backlight_off(void)
40{
41 and_b(~0x40, &PAIORH); /* let it float (up) */
42}
43
44#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Jens Arnold
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef BACKLIGHT_TARGET_H
20#define BACKLIGHT_TARGET_H
21
22#include "config.h"
23#include "rtc.h"
24
25#define __backlight_init() true
26
27static inline void __backlight_on(void)
28{
29 /* Enable square wave */
30 rtc_write(0x0a, rtc_read(0x0a) | 0x40);
31}
32
33static inline void __backlight_off(void)
34{
35 /* Disable square wave */
36 rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
37}
38
39#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;
49 49
50static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ 50static int btn = 0; /* Hopefully keeps track of currently pressed keys... */
51 51
52#if CONFIG_BACKLIGHT 52#ifdef HAVE_BACKLIGHT
53static bool filter_first_keypress; 53static bool filter_first_keypress;
54 54
55void set_backlight_filter_keypress(bool value) 55void set_backlight_filter_keypress(bool value)
@@ -90,7 +90,7 @@ void button_event(int key, bool pressed)
90 static int repeat_count = 0; 90 static int repeat_count = 0;
91 static bool repeat = false; 91 static bool repeat = false;
92 static bool post = false; 92 static bool post = false;
93#if CONFIG_BACKLIGHT 93#ifdef HAVE_BACKLIGHT
94 static bool skip_release = false; 94 static bool skip_release = false;
95#ifdef HAVE_REMOTE_LCD 95#ifdef HAVE_REMOTE_LCD
96 static bool skip_remote_release = false; 96 static bool skip_remote_release = false;
@@ -568,7 +568,7 @@ void button_event(int key, bool pressed)
568 diff = btn ^ lastbtn; 568 diff = btn ^ lastbtn;
569 if(diff && (btn & diff) == 0) 569 if(diff && (btn & diff) == 0)
570 { 570 {
571#if CONFIG_BACKLIGHT 571#ifdef HAVE_BACKLIGHT
572#ifdef HAVE_REMOTE_LCD 572#ifdef HAVE_REMOTE_LCD
573 if(diff & BUTTON_REMOTE) 573 if(diff & BUTTON_REMOTE)
574 if(!skip_remote_release) 574 if(!skip_remote_release)
@@ -635,7 +635,7 @@ void button_event(int key, bool pressed)
635 if (queue_empty(&button_queue)) 635 if (queue_empty(&button_queue))
636 { 636 {
637 queue_post(&button_queue, BUTTON_REPEAT | btn, 0); 637 queue_post(&button_queue, BUTTON_REPEAT | btn, 0);
638#if CONFIG_BACKLIGHT 638#ifdef HAVE_BACKLIGHT
639#ifdef HAVE_REMOTE_LCD 639#ifdef HAVE_REMOTE_LCD
640 if(btn & BUTTON_REMOTE) 640 if(btn & BUTTON_REMOTE)
641 { 641 {
@@ -652,7 +652,7 @@ void button_event(int key, bool pressed)
652 } 652 }
653 else 653 else
654 { 654 {
655#if CONFIG_BACKLIGHT 655#ifdef HAVE_BACKLIGHT
656#ifdef HAVE_REMOTE_LCD 656#ifdef HAVE_REMOTE_LCD
657 if (btn & BUTTON_REMOTE) { 657 if (btn & BUTTON_REMOTE) {
658 if (!remote_filter_first_keypress || is_remote_backlight_on()) 658 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;
25int lcd_backlight_val; 25int lcd_backlight_val;
26 26
27#if LCD_DEPTH <= 8 27#if LCD_DEPTH <= 8
28#if CONFIG_BACKLIGHT 28#ifdef HAVE_BACKLIGHT
29SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0}; 29SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0};
30#endif 30#endif
31SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0}; 31SDL_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)
71 LCD_HEIGHT, background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0); 71 LCD_HEIGHT, background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0);
72} 72}
73 73
74#if CONFIG_BACKLIGHT 74#ifdef HAVE_BACKLIGHT
75void sim_backlight(int value) 75void sim_backlight(int value)
76{ 76{
77 lcd_backlight_val = value; 77 lcd_backlight_val = value;
@@ -116,7 +116,7 @@ void sim_lcd_init(void)
116#endif 116#endif
117 117
118#if LCD_DEPTH <= 8 118#if LCD_DEPTH <= 8
119#if CONFIG_BACKLIGHT 119#ifdef HAVE_BACKLIGHT
120 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max, 120 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max,
121 0, (1<<LCD_DEPTH)); 121 0, (1<<LCD_DEPTH));
122#else 122#else
@@ -132,7 +132,7 @@ void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int))
132 lcd_ex_shades = shades; 132 lcd_ex_shades = shades;
133 lcd_ex_getpixel = getpixel; 133 lcd_ex_getpixel = getpixel;
134 if (shades) { 134 if (shades) {
135#if CONFIG_BACKLIGHT 135#ifdef HAVE_BACKLIGHT
136 if (lcd_backlight_val > 0) { 136 if (lcd_backlight_val > 0) {
137 sdl_set_gradient(lcd_surface, &lcd_color_max, 137 sdl_set_gradient(lcd_surface, &lcd_color_max,
138 &lcd_backlight_color_zero, (1<<LCD_DEPTH), 138 &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)
71 LCD_HEIGHT*CHAR_HEIGHT*CHAR_PIXEL); 71 LCD_HEIGHT*CHAR_HEIGHT*CHAR_PIXEL);
72} 72}
73 73
74#if CONFIG_BACKLIGHT 74#ifdef HAVE_BACKLIGHT
75void sim_backlight(int value) 75void sim_backlight(int value)
76{ 76{
77 if (value > 0) { 77 if (value > 0) {