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
];
35 void screen_init(struct screen
* screen
, enum screen_type screen_type
)
39 #ifdef HAVE_REMOTE_LCD
41 screen
->depth
=LCD_REMOTE_DEPTH
;
42 screen
->has_disk_led
=false;
44 screen
->width
=LCD_REMOTE_WIDTH
;
45 screen
->height
=LCD_REMOTE_HEIGHT
;
46 screen
->setmargins
=&lcd_remote_setmargins
;
47 screen
->getymargin
=&lcd_remote_getymargin
;
48 screen
->getxmargin
=&lcd_remote_getxmargin
;
49 screen
->getstringsize
=&lcd_remote_getstringsize
;
50 #if 1 /* all remote LCDs are bitmapped so far */
51 screen
->setfont
=&lcd_remote_setfont
;
52 screen
->setfont(FONT_UI
);
53 screen
->mono_bitmap
=&lcd_remote_mono_bitmap
;
54 screen
->mono_bitmap_part
=&lcd_remote_mono_bitmap_part
;
55 screen
->set_drawmode
=&lcd_remote_set_drawmode
;
56 #if LCD_REMOTE_DEPTH > 1
57 #if defined(HAVE_LCD_COLOR)
58 screen
->color_to_native
=&lcd_remote_color_to_native
;
60 screen
->get_background
=&lcd_remote_get_background
;
61 screen
->get_foreground
=&lcd_remote_get_foreground
;
62 screen
->set_background
=&lcd_remote_set_background
;
63 screen
->set_foreground
=&lcd_remote_set_foreground
;
64 #endif /* LCD_REMOTE_DEPTH > 1 */
65 screen
->update_rect
=&lcd_remote_update_rect
;
66 screen
->fillrect
=&lcd_remote_fillrect
;
67 screen
->drawrect
=&lcd_remote_drawrect
;
68 screen
->drawpixel
=&lcd_remote_drawpixel
;
69 screen
->drawline
=&lcd_remote_drawline
;
70 screen
->vline
=&lcd_remote_vline
;
71 screen
->hline
=&lcd_remote_hline
;
72 screen
->scroll_step
=&lcd_remote_scroll_step
;
73 screen
->invertscroll
=&lcd_remote_invertscroll
;
74 screen
->puts_style_offset
=&lcd_remote_puts_style_offset
;
75 screen
->puts_scroll_style
=&lcd_remote_puts_scroll_style
;
76 screen
->puts_scroll_style_offset
=&lcd_remote_puts_scroll_style_offset
;
79 #if 0 /* no charcell remote LCDs so far */
80 screen
->double_height
=&lcd_remote_double_height
;
81 screen
->putc
=&lcd_remote_putc
;
82 screen
->get_locked_pattern
=&lcd_remote_get_locked_pattern
;
83 screen
->define_pattern
=&lcd_remote_define_pattern
;
84 screen
->icon
=&lcd_remote_icon
;
87 screen
->init
=&lcd_remote_init
;
88 screen
->putsxy
=&lcd_remote_putsxy
;
89 screen
->puts
=&lcd_remote_puts
;
90 screen
->puts_offset
=&lcd_remote_puts_offset
;
91 screen
->puts_scroll
=&lcd_remote_puts_scroll
;
92 screen
->puts_scroll_offset
=&lcd_remote_puts_scroll_offset
;
93 screen
->scroll_speed
=&lcd_remote_scroll_speed
;
94 screen
->scroll_delay
=&lcd_remote_scroll_delay
;
95 screen
->stop_scroll
=&lcd_remote_stop_scroll
;
96 screen
->clear_display
=&lcd_remote_clear_display
;
97 screen
->update
=&lcd_remote_update
;
98 screen
->backlight_on
=&remote_backlight_on
;
99 screen
->backlight_off
=&remote_backlight_off
;
100 screen
->is_backlight_on
=&is_remote_backlight_on
;
101 screen
->backlight_set_timeout
=&remote_backlight_set_timeout
;
103 #endif /* HAVE_REMOTE_LCD */
107 screen
->depth
=LCD_DEPTH
;
108 #if (CONFIG_LED == LED_VIRTUAL)
109 screen
->has_disk_led
=false;
110 #elif defined(HAVE_REMOTE_LCD)
111 screen
->has_disk_led
=true;
113 screen
->width
=LCD_WIDTH
;
114 screen
->height
=LCD_HEIGHT
;
115 screen
->setmargins
=&lcd_setmargins
;
116 screen
->getymargin
=&lcd_getymargin
;
117 screen
->getxmargin
=&lcd_getxmargin
;
118 screen
->getstringsize
=&lcd_getstringsize
;
119 #ifdef HAVE_LCD_BITMAP
120 screen
->setfont
=&lcd_setfont
;
121 screen
->setfont(FONT_UI
);
122 screen
->mono_bitmap
=&lcd_mono_bitmap
;
123 screen
->mono_bitmap_part
=&lcd_mono_bitmap_part
;
124 screen
->set_drawmode
=&lcd_set_drawmode
;
126 screen
->bitmap
=&lcd_bitmap
;
127 screen
->bitmap_part
=&lcd_bitmap_part
;
129 /* No transparency yet for grayscale lcd */
130 screen
->transparent_bitmap
=&lcd_bitmap
;
131 screen
->transparent_bitmap_part
=&lcd_bitmap_part
;
133 screen
->transparent_bitmap
=&lcd_bitmap_transparent
;
134 screen
->transparent_bitmap_part
=&lcd_bitmap_transparent_part
;
136 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
137 screen
->color_to_native
=&lcd_color_to_native
;
139 screen
->get_background
=&lcd_get_background
;
140 screen
->get_foreground
=&lcd_get_foreground
;
141 screen
->set_background
=&lcd_set_background
;
142 screen
->set_foreground
=&lcd_set_foreground
;
143 #endif /* LCD_DEPTH > 1 */
144 screen
->update_rect
=&lcd_update_rect
;
145 screen
->fillrect
=&lcd_fillrect
;
146 screen
->drawrect
=&lcd_drawrect
;
147 screen
->drawpixel
=&lcd_drawpixel
;
148 screen
->drawline
=&lcd_drawline
;
149 screen
->vline
=&lcd_vline
;
150 screen
->hline
=&lcd_hline
;
151 screen
->scroll_step
=&lcd_scroll_step
;
152 screen
->invertscroll
=&lcd_invertscroll
;
153 screen
->puts_style_offset
=&lcd_puts_style_offset
;
154 screen
->puts_scroll_style
=&lcd_puts_scroll_style
;
155 screen
->puts_scroll_style_offset
=&lcd_puts_scroll_style_offset
;
156 #endif /* HAVE_LCD_BITMAP */
158 #ifdef HAVE_LCD_CHARCELLS
159 screen
->double_height
=&lcd_double_height
;
160 screen
->putc
=&lcd_putc
;
161 screen
->get_locked_pattern
=&lcd_get_locked_pattern
;
162 screen
->define_pattern
=&lcd_define_pattern
;
163 screen
->icon
=&lcd_icon
;
164 #endif /* HAVE_LCD_CHARCELLS */
166 screen
->init
=&lcd_init
;
167 screen
->putsxy
=&lcd_putsxy
;
168 screen
->puts
=&lcd_puts
;
169 screen
->puts_offset
=&lcd_puts_offset
;
170 screen
->puts_scroll
=&lcd_puts_scroll
;
171 screen
->puts_scroll_offset
=&lcd_puts_scroll_offset
;
172 screen
->scroll_speed
=&lcd_scroll_speed
;
173 screen
->scroll_delay
=&lcd_scroll_delay
;
174 screen
->stop_scroll
=&lcd_stop_scroll
;
175 screen
->clear_display
=&lcd_clear_display
;
176 screen
->update
=&lcd_update
;
177 screen
->backlight_on
=&backlight_on
;
178 screen
->backlight_off
=&backlight_off
;
179 screen
->is_backlight_on
=&is_backlight_on
;
180 screen
->backlight_set_timeout
=&backlight_set_timeout
;
183 screen
->screen_type
=screen_type
;
185 screen
->has_buttonbar
=false;
187 gui_textarea_update_nblines(screen
);
190 #ifdef HAVE_LCD_BITMAP
191 void screen_clear_area(struct screen
* display
, int xstart
, int ystart
,
192 int width
, int height
)
194 display
->set_drawmode(DRMODE_SOLID
|DRMODE_INVERSEVID
);
195 display
->fillrect(xstart
, ystart
, width
, height
);
196 display
->set_drawmode(DRMODE_SOLID
);
200 void screen_access_init(void)
204 screen_init(&screens
[i
], i
);