diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/common/SOURCES | 1 | ||||
-rw-r--r-- | uisimulator/common/backlight-sim.c | 84 | ||||
-rw-r--r-- | uisimulator/common/backlight-sim.h | 54 | ||||
-rw-r--r-- | uisimulator/common/lcd-common.c | 55 | ||||
-rw-r--r-- | uisimulator/common/stubs.c | 13 | ||||
-rw-r--r-- | uisimulator/uisimulator.make | 2 |
6 files changed, 157 insertions, 52 deletions
diff --git a/uisimulator/common/SOURCES b/uisimulator/common/SOURCES index bda79b66b9..c1865513f9 100644 --- a/uisimulator/common/SOURCES +++ b/uisimulator/common/SOURCES | |||
@@ -9,4 +9,5 @@ sim_icons.c | |||
9 | sim_tasks.c | 9 | sim_tasks.c |
10 | stubs.c | 10 | stubs.c |
11 | powermgmt-sim.c | 11 | powermgmt-sim.c |
12 | backlight-sim.c | ||
12 | 13 | ||
diff --git a/uisimulator/common/backlight-sim.c b/uisimulator/common/backlight-sim.c new file mode 100644 index 0000000000..ec50249dde --- /dev/null +++ b/uisimulator/common/backlight-sim.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include <stdbool.h> | ||
23 | #include "config.h" | ||
24 | #include "backlight.h" | ||
25 | #include "lcd.h" | ||
26 | |||
27 | #ifdef HAVE_LCD_SLEEP | ||
28 | extern void lcd_awake(void); | ||
29 | #endif | ||
30 | /* in uisimulator/sdl/lcd-bitmap.c and lcd-charcell.c */ | ||
31 | extern void sim_backlight(int value); | ||
32 | |||
33 | void _backlight_on(void) | ||
34 | { | ||
35 | sim_backlight(100); | ||
36 | #if defined(HAVE_LCD_ENABLE) | ||
37 | lcd_enable(true); | ||
38 | #elif defined(HAVE_LCD_SLEEP) | ||
39 | lcd_awake(); | ||
40 | #endif | ||
41 | } | ||
42 | |||
43 | void _backlight_off(void) | ||
44 | { | ||
45 | sim_backlight(0); | ||
46 | #ifdef HAVE_LCD_ENABLE | ||
47 | lcd_enable(false); | ||
48 | #endif | ||
49 | } | ||
50 | |||
51 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
52 | void _backlight_set_brightness(int val) | ||
53 | { | ||
54 | (void)val; | ||
55 | } | ||
56 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | ||
57 | #ifdef HAVE_BUTTON_LIGHT | ||
58 | void _buttonlight_on(void) | ||
59 | { | ||
60 | } | ||
61 | |||
62 | void _buttonlight_off(void) | ||
63 | { | ||
64 | } | ||
65 | |||
66 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS | ||
67 | void _buttonlight_set_brightness(int val) | ||
68 | { | ||
69 | (void)val; | ||
70 | } | ||
71 | #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ | ||
72 | #endif /* HAVE_BUTTON_LIGHT */ | ||
73 | |||
74 | #ifdef HAVE_REMOTE_LCD | ||
75 | void _remote_backlight_on(void) | ||
76 | { | ||
77 | sim_remote_backlight(100); | ||
78 | } | ||
79 | |||
80 | void _remote_backlight_off(void) | ||
81 | { | ||
82 | sim_remote_backlight(0); | ||
83 | } | ||
84 | #endif /* HAVE_REMOTE_LCD */ | ||
diff --git a/uisimulator/common/backlight-sim.h b/uisimulator/common/backlight-sim.h index 59abe36f7d..366ebf8096 100644 --- a/uisimulator/common/backlight-sim.h +++ b/uisimulator/common/backlight-sim.h | |||
@@ -5,9 +5,8 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id:$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * Copyright (C) 2009 by Thomas Martitz | 10 | * Copyright (C) 2009 by Thomas Martitz |
12 | * | 11 | * |
13 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
@@ -19,50 +18,31 @@ | |||
19 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
20 | * | 19 | * |
21 | ****************************************************************************/ | 20 | ****************************************************************************/ |
22 | #ifdef SIMULATOR | ||
23 | 21 | ||
24 | static inline void _backlight_on(void) | 22 | #ifndef BACKLIGHT_SIM_H |
25 | { | 23 | #define BACKLIGHT_SIM_H |
26 | sim_backlight(100); | 24 | |
27 | } | 25 | #include "config.h" |
26 | |||
27 | void _backlight_on(void); | ||
28 | void _backlight_off(void); | ||
28 | 29 | ||
29 | static inline void _backlight_off(void) | ||
30 | { | ||
31 | sim_backlight(0); | ||
32 | } | ||
33 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 30 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
34 | static inline void _backlight_set_brightness(int val) | 31 | void _backlight_set_brightness(int val); |
35 | { | ||
36 | (void)val; | ||
37 | } | ||
38 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | 32 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ |
39 | #ifdef HAVE_BUTTON_LIGHT | 33 | #ifdef HAVE_BUTTON_LIGHT |
40 | static inline void _buttonlight_on(void) | 34 | void _buttonlight_on(void); |
41 | { | 35 | void _buttonlight_off(void); |
42 | } | ||
43 | |||
44 | static inline void _buttonlight_off(void) | ||
45 | { | ||
46 | } | ||
47 | |||
48 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS | 36 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS |
49 | static inline void _buttonlight_set_brightness(int val) | 37 | void _buttonlight_set_brightness(int val); |
50 | { | ||
51 | (void)val; | ||
52 | } | ||
53 | #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ | 38 | #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ |
54 | #endif /* HAVE_BUTTON_LIGHT */ | 39 | #endif /* HAVE_BUTTON_LIGHT */ |
55 | 40 | ||
56 | #ifdef HAVE_REMOTE_LCD | 41 | #ifdef HAVE_REMOTE_LCD |
57 | static inline void _remote_backlight_on(void) | 42 | void _remote_backlight_on(void); |
58 | { | 43 | void _remote_backlight_off(void); |
59 | sim_remote_backlight(100); | ||
60 | } | ||
61 | |||
62 | static inline void _remote_backlight_off(void) | ||
63 | { | ||
64 | sim_remote_backlight(0); | ||
65 | } | ||
66 | #endif /* HAVE_REMOTE_LCD */ | 44 | #endif /* HAVE_REMOTE_LCD */ |
67 | 45 | ||
68 | #endif /* SIMULATOR */ | 46 | |
47 | #endif /* BACKLIGHT_SIM_H */ | ||
48 | |||
diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c index 7d40f36b0f..52db776856 100644 --- a/uisimulator/common/lcd-common.c +++ b/uisimulator/common/lcd-common.c | |||
@@ -22,8 +22,15 @@ | |||
22 | * | 22 | * |
23 | ****************************************************************************/ | 23 | ****************************************************************************/ |
24 | 24 | ||
25 | #include "config.h" | ||
25 | #include "lcd.h" | 26 | #include "lcd.h" |
26 | #include "lcd-sdl.h" | 27 | |
28 | #ifdef HAVE_LCD_ENABLE | ||
29 | static bool lcd_enabled = false; | ||
30 | #endif | ||
31 | #ifdef HAVE_LCD_SLEEP | ||
32 | static bool lcd_sleeping = true; | ||
33 | #endif | ||
27 | 34 | ||
28 | void lcd_set_flip(bool yesno) | 35 | void lcd_set_flip(bool yesno) |
29 | { | 36 | { |
@@ -64,3 +71,49 @@ void lcd_remote_set_invert_display(bool invert) | |||
64 | (void)invert; | 71 | (void)invert; |
65 | } | 72 | } |
66 | #endif | 73 | #endif |
74 | |||
75 | #ifdef HAVE_LCD_SLEEP | ||
76 | void lcd_sleep(void) | ||
77 | { | ||
78 | lcd_sleeping = true; | ||
79 | } | ||
80 | |||
81 | void lcd_awake(void) | ||
82 | { | ||
83 | if (lcd_sleeping) | ||
84 | { | ||
85 | lcd_activation_call_hook(); | ||
86 | lcd_sleeping = false; | ||
87 | } | ||
88 | } | ||
89 | #endif | ||
90 | #ifdef HAVE_LCD_ENABLE | ||
91 | void lcd_enable(bool on) | ||
92 | { | ||
93 | if (on && !lcd_enabled) | ||
94 | { | ||
95 | #ifdef HAVE_LCD_SLEEP | ||
96 | /* lcd_awake will handle the activation call */ | ||
97 | lcd_awake(); | ||
98 | #else | ||
99 | lcd_activation_call_hook(); | ||
100 | #endif | ||
101 | } | ||
102 | lcd_enabled = on; | ||
103 | } | ||
104 | #endif | ||
105 | |||
106 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
107 | bool lcd_active(void) | ||
108 | { | ||
109 | bool retval = false; | ||
110 | #ifdef HAVE_LCD_ENABLE | ||
111 | retval = lcd_enabled; | ||
112 | #endif | ||
113 | #ifdef HAVE_LCD_SLEEP | ||
114 | if (!retval) | ||
115 | retval = !lcd_sleeping; | ||
116 | #endif | ||
117 | return retval; | ||
118 | } | ||
119 | #endif | ||
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index 5d3c54a8d0..1d0d6c51d8 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c | |||
@@ -202,19 +202,6 @@ bool headphones_inserted(void) | |||
202 | } | 202 | } |
203 | #endif | 203 | #endif |
204 | 204 | ||
205 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
206 | bool lcd_active(void) | ||
207 | { | ||
208 | return true; | ||
209 | } | ||
210 | #endif | ||
211 | |||
212 | #ifdef HAVE_LCD_SLEEP | ||
213 | void lcd_sleep(void) | ||
214 | { | ||
215 | } | ||
216 | #endif | ||
217 | |||
218 | #ifdef HAVE_SPDIF_POWER | 205 | #ifdef HAVE_SPDIF_POWER |
219 | void spdif_power_enable(bool on) | 206 | void spdif_power_enable(bool on) |
220 | { | 207 | { |
diff --git a/uisimulator/uisimulator.make b/uisimulator/uisimulator.make index f39d6e0265..9aeb02cd3d 100644 --- a/uisimulator/uisimulator.make +++ b/uisimulator/uisimulator.make | |||
@@ -28,7 +28,7 @@ $(SIMLIB): $$(SIMOBJ) $(UIBMP) | |||
28 | $(SILENT)$(shell rm -f $@) | 28 | $(SILENT)$(shell rm -f $@) |
29 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null | 29 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null |
30 | 30 | ||
31 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) | 31 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(FIRMLIB) $(SIMLIB) $(VOICESPEEXLIB) |
32 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) | 32 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) |
33 | 33 | ||
34 | $(BUILDDIR)/uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c | 34 | $(BUILDDIR)/uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c |