1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2005 by Kevin Ferrare
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
21 #include <lcd-remote.h>
22 #include "backlight.h"
30 #include "screen_access.h"
33 struct screen screens
[NB_SCREENS
] =
36 .screen_type
=SCREEN_MAIN
,
40 #if defined(HAVE_LCD_COLOR)
45 #ifdef HAVE_LCD_BITMAP
46 .pixel_format
=LCD_PIXELFORMAT
,
48 #if (CONFIG_LED == LED_VIRTUAL)
50 #elif defined(HAVE_REMOTE_LCD)
53 .setmargins
=&lcd_setmargins
,
54 .getymargin
=&lcd_getymargin
,
55 .getxmargin
=&lcd_getxmargin
,
56 .getstringsize
=&lcd_getstringsize
,
57 #ifdef HAVE_LCD_BITMAP
58 .setfont
=&lcd_setfont
,
59 .mono_bitmap
=&lcd_mono_bitmap
,
60 .mono_bitmap_part
=&lcd_mono_bitmap_part
,
61 .set_drawmode
=&lcd_set_drawmode
,
62 .bitmap
=(screen_bitmap_func
*)&lcd_bitmap
,
63 .bitmap_part
=(screen_bitmap_part_func
*)&lcd_bitmap_part
,
65 /* No transparency yet for grayscale and mono lcd */
66 .transparent_bitmap
=(screen_bitmap_func
*)&lcd_bitmap
,
67 .transparent_bitmap_part
=(screen_bitmap_part_func
*)&lcd_bitmap_part
,
69 .transparent_bitmap
=(screen_bitmap_func
*)&lcd_bitmap_transparent
,
70 .transparent_bitmap_part
=(screen_bitmap_part_func
*)&lcd_bitmap_transparent_part
,
73 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
74 .color_to_native
=&lcd_color_to_native
,
76 .get_background
=&lcd_get_background
,
77 .get_foreground
=&lcd_get_foreground
,
78 .set_background
=&lcd_set_background
,
79 .set_foreground
=&lcd_set_foreground
,
81 .set_selector_start
=&lcd_set_selector_start
,
82 .set_selector_end
=&lcd_set_selector_end
,
83 .set_selector_text
=&lcd_set_selector_text
,
85 #endif /* LCD_DEPTH > 1 */
86 .update_rect
=&lcd_update_rect
,
87 .fillrect
=&lcd_fillrect
,
88 .drawrect
=&lcd_drawrect
,
89 .drawpixel
=&lcd_drawpixel
,
90 .drawline
=&lcd_drawline
,
93 .scroll_step
=&lcd_scroll_step
,
94 .invertscroll
=&lcd_invertscroll
,
95 .puts_style_offset
=&lcd_puts_style_offset
,
96 .puts_scroll_style
=&lcd_puts_scroll_style
,
97 .puts_scroll_style_offset
=&lcd_puts_scroll_style_offset
,
98 #endif /* HAVE_LCD_BITMAP */
100 #ifdef HAVE_LCD_CHARCELLS
101 .double_height
=&lcd_double_height
,
103 .get_locked_pattern
=&lcd_get_locked_pattern
,
104 .define_pattern
=&lcd_define_pattern
,
105 .unlock_pattern
=&lcd_unlock_pattern
,
107 #endif /* HAVE_LCD_CHARCELLS */
111 .puts_offset
=&lcd_puts_offset
,
112 .puts_scroll
=&lcd_puts_scroll
,
113 .puts_scroll_offset
=&lcd_puts_scroll_offset
,
114 .scroll_speed
=&lcd_scroll_speed
,
115 .scroll_delay
=&lcd_scroll_delay
,
116 .stop_scroll
=&lcd_stop_scroll
,
117 .clear_display
=&lcd_clear_display
,
119 .backlight_on
=&backlight_on
,
120 .backlight_off
=&backlight_off
,
121 .is_backlight_on
=&is_backlight_on
,
122 .backlight_set_timeout
=&backlight_set_timeout
124 ,.has_buttonbar
=false
127 #ifdef HAVE_REMOTE_LCD
129 .screen_type
=SCREEN_REMOTE
,
130 .width
=LCD_REMOTE_WIDTH
,
131 .height
=LCD_REMOTE_HEIGHT
,
132 .depth
=LCD_REMOTE_DEPTH
,
133 .is_color
=false,/* No color remotes yet */
134 .pixel_format
=LCD_REMOTE_PIXELFORMAT
,
136 .setmargins
=&lcd_remote_setmargins
,
137 .getymargin
=&lcd_remote_getymargin
,
138 .getxmargin
=&lcd_remote_getxmargin
,
139 .getstringsize
=&lcd_remote_getstringsize
,
140 #if 1 /* all remote LCDs are bitmapped so far */
141 .setfont
=&lcd_remote_setfont
,
142 .mono_bitmap
=&lcd_remote_mono_bitmap
,
143 .mono_bitmap_part
=&lcd_remote_mono_bitmap_part
,
144 .bitmap
=(screen_bitmap_func
*)&lcd_remote_bitmap
,
145 .bitmap_part
=(screen_bitmap_part_func
*)&lcd_remote_bitmap_part
,
146 .set_drawmode
=&lcd_remote_set_drawmode
,
147 #if LCD_REMOTE_DEPTH <= 2
148 /* No transparency yet for grayscale and mono lcd */
149 .transparent_bitmap
=(screen_bitmap_func
*)&lcd_remote_bitmap
,
150 .transparent_bitmap_part
=(screen_bitmap_part_func
*)&lcd_remote_bitmap_part
,
151 /* No colour remotes yet */
153 #if LCD_REMOTE_DEPTH > 1
154 #if defined(HAVE_LCD_COLOR)
155 .color_to_native
=&lcd_remote_color_to_native
,
157 .get_background
=&lcd_remote_get_background
,
158 .get_foreground
=&lcd_remote_get_foreground
,
159 .set_background
=&lcd_remote_set_background
,
160 .set_foreground
=&lcd_remote_set_foreground
,
161 #endif /* LCD_REMOTE_DEPTH > 1 */
162 .update_rect
=&lcd_remote_update_rect
,
163 .fillrect
=&lcd_remote_fillrect
,
164 .drawrect
=&lcd_remote_drawrect
,
165 .drawpixel
=&lcd_remote_drawpixel
,
166 .drawline
=&lcd_remote_drawline
,
167 .vline
=&lcd_remote_vline
,
168 .hline
=&lcd_remote_hline
,
169 .scroll_step
=&lcd_remote_scroll_step
,
170 .invertscroll
=&lcd_remote_invertscroll
,
171 .puts_style_offset
=&lcd_remote_puts_style_offset
,
172 .puts_scroll_style
=&lcd_remote_puts_scroll_style
,
173 .puts_scroll_style_offset
=&lcd_remote_puts_scroll_style_offset
,
176 #if 0 /* no charcell remote LCDs so far */
177 .double_height
=&lcd_remote_double_height
,
178 .putc
=&lcd_remote_putc
,
179 .get_locked_pattern
=&lcd_remote_get_locked_pattern
,
180 .define_pattern
=&lcd_remote_define_pattern
,
181 .icon
=&lcd_remote_icon
,
183 .putsxy
=&lcd_remote_putsxy
,
184 .puts
=&lcd_remote_puts
,
185 .puts_offset
=&lcd_remote_puts_offset
,
186 .puts_scroll
=&lcd_remote_puts_scroll
,
187 .puts_scroll_offset
=&lcd_remote_puts_scroll_offset
,
188 .scroll_speed
=&lcd_remote_scroll_speed
,
189 .scroll_delay
=&lcd_remote_scroll_delay
,
190 .stop_scroll
=&lcd_remote_stop_scroll
,
191 .clear_display
=&lcd_remote_clear_display
,
192 .update
=&lcd_remote_update
,
193 .backlight_on
=&remote_backlight_on
,
194 .backlight_off
=&remote_backlight_off
,
195 .is_backlight_on
=&is_remote_backlight_on
,
196 .backlight_set_timeout
=&remote_backlight_set_timeout
198 #endif /* HAVE_REMOTE_LCD */
201 #ifdef HAVE_LCD_BITMAP
202 void screen_clear_area(struct screen
* display
, int xstart
, int ystart
,
203 int width
, int height
)
205 display
->set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
206 display
->fillrect(xstart
, ystart
, width
, height
);
207 display
->set_drawmode(DRMODE_SOLID
);
211 void screen_access_init(void)
216 #ifdef HAVE_LCD_BITMAP
217 ((struct screen
*)&screens
[i
])->setfont(FONT_UI
);
219 gui_textarea_update_nblines(&screens
[i
]);