diff options
-rw-r--r-- | apps/settings.c | 8 | ||||
-rw-r--r-- | apps/settings_menu.c | 14 | ||||
-rw-r--r-- | apps/wps-display.c | 2 | ||||
-rw-r--r-- | firmware/backlight.c | 38 | ||||
-rw-r--r-- | firmware/export/config-fmrecorder.h | 2 | ||||
-rw-r--r-- | firmware/export/config-h100.h | 2 | ||||
-rw-r--r-- | firmware/export/config-player.h | 2 | ||||
-rw-r--r-- | firmware/export/config-recorder.h | 2 | ||||
-rw-r--r-- | firmware/export/config-recorderv2.h | 2 | ||||
-rw-r--r-- | firmware/export/config.h | 6 |
10 files changed, 44 insertions, 34 deletions
diff --git a/apps/settings.c b/apps/settings.c index 7ca3820016..ff9c57d136 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -182,12 +182,14 @@ static const struct bit_entry rtc_bits[] = | |||
182 | {2, S_O(repeat_mode), REPEAT_ALL, "repeat", "off,all,one" }, | 182 | {2, S_O(repeat_mode), REPEAT_ALL, "repeat", "off,all,one" }, |
183 | /* LCD */ | 183 | /* LCD */ |
184 | {6, S_O(contrast), 40, "contrast", NULL }, | 184 | {6, S_O(contrast), 40, "contrast", NULL }, |
185 | #ifdef HAVE_BACKLIGHT | 185 | #ifdef CONFIG_BACKLIGHT |
186 | #ifdef HAVE_CHARGING | ||
186 | {1, S_O(backlight_on_when_charging), false, | 187 | {1, S_O(backlight_on_when_charging), false, |
187 | "backlight when plugged", off_on }, | 188 | "backlight when plugged", off_on }, |
189 | #endif | ||
188 | {5, S_O(backlight_timeout), 5, "backlight timeout", | 190 | {5, S_O(backlight_timeout), 5, "backlight timeout", |
189 | "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90" }, | 191 | "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90" }, |
190 | #endif | 192 | #endif /* CONFIG_BACKLIGHT */ |
191 | #ifdef HAVE_LCD_BITMAP | 193 | #ifdef HAVE_LCD_BITMAP |
192 | {1, S_O(invert), false, "invert", off_on }, | 194 | {1, S_O(invert), false, "invert", off_on }, |
193 | {1, S_O(flip_display), false, "flip display", off_on }, | 195 | {1, S_O(flip_display), false, "flip display", off_on }, |
@@ -247,7 +249,7 @@ static const struct bit_entry hd_bits[] = | |||
247 | 249 | ||
248 | /* # of bits, offset+size, default, .cfg name, .cfg values */ | 250 | /* # of bits, offset+size, default, .cfg name, .cfg values */ |
249 | /* more display */ | 251 | /* more display */ |
250 | #ifdef HAVE_BACKLIGHT | 252 | #ifdef CONFIG_BACKLIGHT |
251 | {1, S_O(caption_backlight), false, "caption backlight", off_on }, | 253 | {1, S_O(caption_backlight), false, "caption backlight", off_on }, |
252 | #endif | 254 | #endif |
253 | {4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */ | 255 | {4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */ |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index c61352b1cc..eae39f905f 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -77,7 +77,7 @@ static bool contrast(void) | |||
77 | MAX_CONTRAST_SETTING ); | 77 | MAX_CONTRAST_SETTING ); |
78 | } | 78 | } |
79 | 79 | ||
80 | #ifdef HAVE_BACKLIGHT | 80 | #ifdef CONFIG_BACKLIGHT |
81 | static bool caption_backlight(void) | 81 | static bool caption_backlight(void) |
82 | { | 82 | { |
83 | bool rc = set_bool( str(LANG_CAPTION_BACKLIGHT), | 83 | bool rc = set_bool( str(LANG_CAPTION_BACKLIGHT), |
@@ -575,7 +575,8 @@ static bool useMRB(void) | |||
575 | names, 3, NULL ); | 575 | names, 3, NULL ); |
576 | } | 576 | } |
577 | 577 | ||
578 | #ifdef HAVE_BACKLIGHT | 578 | #ifdef CONFIG_BACKLIGHT |
579 | #ifdef HAVE_CHARGING | ||
579 | static bool backlight_on_when_charging(void) | 580 | static bool backlight_on_when_charging(void) |
580 | { | 581 | { |
581 | bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING), | 582 | bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING), |
@@ -583,6 +584,7 @@ static bool backlight_on_when_charging(void) | |||
583 | backlight_set_on_when_charging(global_settings.backlight_on_when_charging); | 584 | backlight_set_on_when_charging(global_settings.backlight_on_when_charging); |
584 | return result; | 585 | return result; |
585 | } | 586 | } |
587 | #endif | ||
586 | 588 | ||
587 | static bool backlight_timer(void) | 589 | static bool backlight_timer(void) |
588 | { | 590 | { |
@@ -610,7 +612,7 @@ static bool backlight_timer(void) | |||
610 | return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout, | 612 | return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout, |
611 | INT, names, 19, backlight_set_timeout ); | 613 | INT, names, 19, backlight_set_timeout ); |
612 | } | 614 | } |
613 | #endif /* HAVE_BACKLIGHT */ | 615 | #endif /* CONFIG_BACKLIGHT */ |
614 | 616 | ||
615 | static bool poweroff_idle_timer(void) | 617 | static bool poweroff_idle_timer(void) |
616 | { | 618 | { |
@@ -1162,11 +1164,13 @@ static bool lcd_settings_menu(void) | |||
1162 | bool result; | 1164 | bool result; |
1163 | 1165 | ||
1164 | static const struct menu_item items[] = { | 1166 | static const struct menu_item items[] = { |
1165 | #ifdef HAVE_BACKLIGHT | 1167 | #ifdef CONFIG_BACKLIGHT |
1166 | { ID2P(LANG_BACKLIGHT), backlight_timer }, | 1168 | { ID2P(LANG_BACKLIGHT), backlight_timer }, |
1169 | #ifdef HAVE_CHARGING | ||
1167 | { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, | 1170 | { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, |
1168 | { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight }, | ||
1169 | #endif | 1171 | #endif |
1172 | { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight }, | ||
1173 | #endif /* CONFIG_BACKLIGHT */ | ||
1170 | { ID2P(LANG_CONTRAST), contrast }, | 1174 | { ID2P(LANG_CONTRAST), contrast }, |
1171 | #ifdef HAVE_LCD_BITMAP | 1175 | #ifdef HAVE_LCD_BITMAP |
1172 | { ID2P(LANG_INVERT), invert }, | 1176 | { ID2P(LANG_INVERT), invert }, |
diff --git a/apps/wps-display.c b/apps/wps-display.c index 90fec56001..a261f21a5d 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c | |||
@@ -987,7 +987,7 @@ bool wps_refresh(struct mp3entry* id3, | |||
987 | peak_meter_enabled = enable_pm; | 987 | peak_meter_enabled = enable_pm; |
988 | #endif | 988 | #endif |
989 | 989 | ||
990 | #if defined(HAVE_BACKLIGHT) && !defined(SIMULATOR) | 990 | #if defined(CONFIG_BACKLIGHT) && !defined(SIMULATOR) |
991 | if (global_settings.caption_backlight && id3) { | 991 | if (global_settings.caption_backlight && id3) { |
992 | /* turn on backlight n seconds before track ends, and turn it off n | 992 | /* turn on backlight n seconds before track ends, and turn it off n |
993 | seconds into the new track. n == backlight_timeout, or 5s */ | 993 | seconds into the new track. n == backlight_timeout, or 5s */ |
diff --git a/firmware/backlight.c b/firmware/backlight.c index fea22a06a4..de3ebe3e05 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "power.h" | 28 | #include "power.h" |
29 | #include "system.h" | 29 | #include "system.h" |
30 | 30 | ||
31 | #ifdef HAVE_BACKLIGHT | 31 | #ifdef CONFIG_BACKLIGHT |
32 | 32 | ||
33 | const char backlight_timeout_value[19] = | 33 | const char backlight_timeout_value[19] = |
34 | { | 34 | { |
@@ -51,30 +51,30 @@ static unsigned int backlight_timeout = 5; | |||
51 | 51 | ||
52 | static void __backlight_off(void) | 52 | static void __backlight_off(void) |
53 | { | 53 | { |
54 | #ifdef IRIVER_H100 | 54 | #if CONFIG_BACKLIGHT == BL_IRIVER |
55 | GPIO1_OUT |= 0x00020000; | 55 | GPIO1_OUT |= 0x00020000; |
56 | #else | 56 | #elif CONFIG_BACKLIGHT == BL_RTC |
57 | #ifdef HAVE_RTC | ||
58 | /* Disable square wave */ | 57 | /* Disable square wave */ |
59 | rtc_write(0x0a, rtc_read(0x0a) & ~0x40); | 58 | rtc_write(0x0a, rtc_read(0x0a) & ~0x40); |
60 | #else | 59 | #elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */ |
61 | and_b(~0x40, &PAIORH); | 60 | and_b(~0x40, &PAIORH); /* let it float (up) */ |
62 | #endif | 61 | #elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */ |
62 | and_b(~0x40, &PADRH); /* drive it low */ | ||
63 | #endif | 63 | #endif |
64 | } | 64 | } |
65 | 65 | ||
66 | static void __backlight_on(void) | 66 | static void __backlight_on(void) |
67 | { | 67 | { |
68 | #ifdef IRIVER_H100 | 68 | #if CONFIG_BACKLIGHT == BL_IRIVER |
69 | GPIO1_OUT &= ~0x00020000; | 69 | GPIO1_OUT &= ~0x00020000; |
70 | #else | 70 | #elif CONFIG_BACKLIGHT == BL_RTC |
71 | #ifdef HAVE_RTC | ||
72 | /* Enable square wave */ | 71 | /* Enable square wave */ |
73 | rtc_write(0x0a, rtc_read(0x0a) | 0x40); | 72 | rtc_write(0x0a, rtc_read(0x0a) | 0x40); |
74 | #else | 73 | #elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */ |
75 | and_b(~0x40, &PADRH); | 74 | and_b(~0x40, &PADRH); /* drive an set low */ |
76 | or_b(0x40, &PAIORH); | 75 | or_b(0x40, &PAIORH); |
77 | #endif | 76 | #elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */ |
77 | or_b(0x40, &PADRH); /* drive it high */ | ||
78 | #endif | 78 | #endif |
79 | } | 79 | } |
80 | 80 | ||
@@ -187,15 +187,13 @@ void backlight_init(void) | |||
187 | create_thread(backlight_thread, backlight_stack, | 187 | create_thread(backlight_thread, backlight_stack, |
188 | sizeof(backlight_stack), backlight_thread_name); | 188 | sizeof(backlight_stack), backlight_thread_name); |
189 | 189 | ||
190 | #ifdef HAVE_LCD_CHARCELLS | 190 | #if CONFIG_BACKLIGHT == BL_IRIVER |
191 | GPIO1_ENABLE |= 0x00020000; | ||
192 | GPIO1_FUNCTION |= 0x00020000; | ||
193 | #elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI | ||
191 | PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */ | 194 | PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */ |
192 | or_b(0x40, &PAIORH); /* ..and output */ | 195 | or_b(0x40, &PAIORH); /* ..and output */ |
193 | #endif | 196 | #endif |
194 | |||
195 | #ifdef IRIVER_H100 | ||
196 | GPIO1_ENABLE |= 0x00020000; | ||
197 | GPIO1_FUNCTION |= 0x00020000; | ||
198 | #endif | ||
199 | backlight_on(); | 197 | backlight_on(); |
200 | } | 198 | } |
201 | 199 | ||
@@ -210,5 +208,5 @@ void backlight_set_timeout(int index) {(void)index;} | |||
210 | bool backlight_get_on_when_charging(void) {return 0;} | 208 | bool backlight_get_on_when_charging(void) {return 0;} |
211 | void backlight_set_on_when_charging(bool yesno) {(void)yesno;} | 209 | void backlight_set_on_when_charging(bool yesno) {(void)yesno;} |
212 | 210 | ||
213 | #endif /* #ifdef HAVE_BACKLIGHT */ | 211 | #endif /* #ifdef CONFIG_BACKLIGHT */ |
214 | 212 | ||
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index 0903e66c6d..c20c36ea43 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h | |||
@@ -71,7 +71,7 @@ | |||
71 | #define HAVE_LED | 71 | #define HAVE_LED |
72 | 72 | ||
73 | /* Define this for LCD backlight available */ | 73 | /* Define this for LCD backlight available */ |
74 | #define HAVE_BACKLIGHT | 74 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ |
75 | 75 | ||
76 | /* Define this if you have a software controlled poweroff */ | 76 | /* Define this if you have a software controlled poweroff */ |
77 | #define HAVE_SW_POWEROFF | 77 | #define HAVE_SW_POWEROFF |
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 9e56aa2c59..405e839dd5 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #define ROM_START 0x11010 | 25 | #define ROM_START 0x11010 |
26 | 26 | ||
27 | /* Define this for LCD backlight available */ | 27 | /* Define this for LCD backlight available */ |
28 | #define HAVE_BACKLIGHT | 28 | #define CONFIG_BACKLIGHT BL_IRIVER /* port controlled */ |
29 | 29 | ||
30 | /* Define this to the CPU frequency */ | 30 | /* Define this to the CPU frequency */ |
31 | #define CPU_FREQ 11289600 | 31 | #define CPU_FREQ 11289600 |
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index 5a8f080669..6ef61234ad 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h | |||
@@ -64,6 +64,6 @@ | |||
64 | #define HAVE_LED | 64 | #define HAVE_LED |
65 | 65 | ||
66 | /* Define this for LCD backlight available */ | 66 | /* Define this for LCD backlight available */ |
67 | #define HAVE_BACKLIGHT | 67 | #define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */ |
68 | 68 | ||
69 | #endif /* SIMULATOR */ | 69 | #endif /* SIMULATOR */ |
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index eefe5e371b..79fd116d4f 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h | |||
@@ -65,7 +65,7 @@ | |||
65 | #define HAVE_LED | 65 | #define HAVE_LED |
66 | 66 | ||
67 | /* Define this for LCD backlight available */ | 67 | /* Define this for LCD backlight available */ |
68 | #define HAVE_BACKLIGHT | 68 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ |
69 | 69 | ||
70 | /* Define this for S/PDIF output available */ | 70 | /* Define this for S/PDIF output available */ |
71 | #define HAVE_SPDIF_OUT | 71 | #define HAVE_SPDIF_OUT |
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index 575a88fd7c..028a27095c 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h | |||
@@ -71,7 +71,7 @@ | |||
71 | #define HAVE_LED | 71 | #define HAVE_LED |
72 | 72 | ||
73 | /* Define this for LCD backlight available */ | 73 | /* Define this for LCD backlight available */ |
74 | #define HAVE_BACKLIGHT | 74 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ |
75 | 75 | ||
76 | /* Define this if you have a software controlled poweroff */ | 76 | /* Define this if you have a software controlled poweroff */ |
77 | #define HAVE_SW_POWEROFF | 77 | #define HAVE_SW_POWEROFF |
diff --git a/firmware/export/config.h b/firmware/export/config.h index cda5c8cee7..7c0e285bbe 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -46,6 +46,12 @@ | |||
46 | #define BATT_4AA_NIMH 1500 | 46 | #define BATT_4AA_NIMH 1500 |
47 | #define BATT_3AAA_ALKALINE 1000 | 47 | #define BATT_3AAA_ALKALINE 1000 |
48 | 48 | ||
49 | /* CONFIG_BACKLIGHT */ | ||
50 | #define BL_PA14_LO 0 /* Player, PA14 low active */ | ||
51 | #define BL_RTC 1 /* Recorder, RTC square wave output */ | ||
52 | #define BL_PA14_HI 2 /* Ondio, PA14 high active */ | ||
53 | #define BL_IRIVER 3 /* IRiver GPIO */ | ||
54 | |||
49 | /* now go and pick yours */ | 55 | /* now go and pick yours */ |
50 | #if defined(ARCHOS_PLAYER) | 56 | #if defined(ARCHOS_PLAYER) |
51 | #include "config-player.h" | 57 | #include "config-player.h" |