1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2005 Jonas H�gqvist
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 **************************************************************************/
20 #include "playergfx.h"
24 #ifdef HAVE_LCD_BITMAP
25 #define DISPLAY_WIDTH LCD_WIDTH
26 #define DISPLAY_HEIGHT LCD_HEIGHT
29 #ifdef HAVE_REMOTE_LCD
30 #define REMOTE_WIDTH LCD_REMOTE_WIDTH
31 #define REMOTE_HEIGHT LCD_REMOTE_HEIGHT
32 #include "remote_rockboxlogo.h"
33 #define REMOTE_LOGO_WIDTH BMPWIDTH_remote_rockboxlogo
34 #define REMOTE_LOGO_HEIGHT BMPHEIGHT_remote_rockboxlogo
35 #define REMOTE_LOGO remote_rockboxlogo
36 extern const fb_remote_data remote_rockboxlogo
[];
37 #endif /* HAVE_REMOTE_LCD */
39 #define LOGO rockboxlogo
40 #include "rockboxlogo.h"
41 #define LOGO_WIDTH BMPWIDTH_rockboxlogo
42 #define LOGO_HEIGHT BMPHEIGHT_rockboxlogo
43 extern const fb_data rockboxlogo
[];
45 #else /* !LCD_BITMAP */
46 #define DISPLAY_WIDTH 55
47 #define DISPLAY_HEIGHT 14
51 #define LOGO rockbox16x7
52 const unsigned char rockbox16x7
[] = {
53 0x47, 0x18, 0xa6, 0xd8, 0x66, 0xde, 0xb7, 0x9b,
54 0x76, 0xdb, 0x26, 0xdb, 0x66, 0xde,
56 #endif /* !LCD_BITMAP */
58 /* variable button definitions */
59 #if CONFIG_KEYPAD == PLAYER_PAD
60 #define LP_QUIT BUTTON_STOP
61 #define LP_DEC_X BUTTON_LEFT
62 #define LP_INC_X BUTTON_RIGHT
63 #define LP_DEC_Y (BUTTON_ON | BUTTON_LEFT)
64 #define LP_INC_Y (BUTTON_ON | BUTTON_RIGHT)
66 #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
67 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
68 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
69 #define LP_QUIT BUTTON_MENU
70 #define LP_DEC_X BUTTON_LEFT
71 #define LP_INC_X BUTTON_RIGHT
72 #define LP_DEC_Y BUTTON_SCROLL_BACK
73 #define LP_INC_Y BUTTON_SCROLL_FWD
75 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
76 #define LP_QUIT BUTTON_PLAY
77 #define LP_DEC_X BUTTON_LEFT
78 #define LP_INC_X BUTTON_RIGHT
79 #define LP_DEC_Y BUTTON_DOWN
80 #define LP_INC_Y BUTTON_UP
82 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
83 #define LP_QUIT BUTTON_POWER
84 #define LP_DEC_X BUTTON_LEFT
85 #define LP_INC_X BUTTON_RIGHT
86 #define LP_DEC_Y BUTTON_DOWN
87 #define LP_INC_Y BUTTON_UP
89 #elif CONFIG_KEYPAD == GIGABEAT_PAD
90 #define LP_QUIT BUTTON_POWER
91 #define LP_DEC_X BUTTON_LEFT
92 #define LP_INC_X BUTTON_RIGHT
93 #define LP_DEC_Y BUTTON_DOWN
94 #define LP_INC_Y BUTTON_UP
96 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
97 (CONFIG_KEYPAD == SANSA_C200_PAD)
98 #define LP_QUIT BUTTON_POWER
99 #define LP_DEC_X BUTTON_LEFT
100 #define LP_INC_X BUTTON_RIGHT
101 #define LP_DEC_Y BUTTON_DOWN
102 #define LP_INC_Y BUTTON_UP
104 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
105 #define LP_QUIT BUTTON_POWER
106 #define LP_DEC_X BUTTON_LEFT
107 #define LP_INC_X BUTTON_RIGHT
108 #define LP_DEC_Y BUTTON_SCROLL_DOWN
109 #define LP_INC_Y BUTTON_SCROLL_UP
111 #elif CONFIG_KEYPAD == MROBE500_PAD
112 #define LP_QUIT BUTTON_POWER
113 #define LP_DEC_X BUTTON_LEFT
114 #define LP_INC_X BUTTON_RIGHT
115 #define LP_DEC_Y BUTTON_RC_DOWN
116 #define LP_INC_Y BUTTON_RC_PLAY
118 #elif CONFIG_KEYPAD == GIGABEAT_S_PAD
119 #define LP_QUIT BUTTON_BACK
120 #define LP_DEC_X BUTTON_LEFT
121 #define LP_INC_X BUTTON_RIGHT
122 #define LP_DEC_Y BUTTON_DOWN
123 #define LP_INC_Y BUTTON_UP
125 #elif CONFIG_KEYPAD == MROBE100_PAD
126 #define LP_QUIT BUTTON_POWER
127 #define LP_DEC_X BUTTON_LEFT
128 #define LP_INC_X BUTTON_RIGHT
129 #define LP_DEC_Y BUTTON_DOWN
130 #define LP_INC_Y BUTTON_UP
132 #elif CONFIG_KEYPAD == IAUDIO_M3_PAD
133 #define LP_QUIT BUTTON_RC_REC
134 #define LP_DEC_X BUTTON_RC_REW
135 #define LP_INC_X BUTTON_RC_FF
136 #define LP_DEC_Y BUTTON_RC_VOL_DOWN
137 #define LP_INC_Y BUTTON_RC_VOL_UP
139 #elif CONFIG_KEYPAD == COWOND2_PAD
140 #define LP_QUIT BUTTON_POWER
143 #define LP_QUIT BUTTON_OFF
144 #define LP_DEC_X BUTTON_LEFT
145 #define LP_INC_X BUTTON_RIGHT
146 #define LP_DEC_Y BUTTON_DOWN
147 #define LP_INC_Y BUTTON_UP
150 #ifdef CONFIG_REMOTE_KEYPAD
151 #if (CONFIG_REMOTE_KEYPAD == H100_REMOTE) || \
152 (CONFIG_REMOTE_KEYPAD == H300_REMOTE)
153 #define LP_R_QUIT BUTTON_RC_STOP
154 #define LP_R_DEC_X BUTTON_RC_REW
155 #define LP_R_INC_X BUTTON_RC_FF
156 #define LP_R_DEC_Y BUTTON_RC_SOURCE
157 #define LP_R_INC_Y BUTTON_RC_BITRATE
159 #endif /* CONFIG_REMOTE_KEYPAD */
163 #define LP_QUIT BUTTON_TOPLEFT
166 #define LP_DEC_X BUTTON_MIDLEFT
169 #define LP_INC_X BUTTON_MIDRIGHT
172 #define LP_DEC_Y BUTTON_TOPMIDDLE
175 #define LP_INC_Y BUTTON_BOTTOMMIDDLE
179 enum plugin_status
plugin_start(const struct plugin_api
* api
, const void* parameter
) {
182 int x
= (DISPLAY_WIDTH
/ 2) - (LOGO_WIDTH
/ 2);
183 int y
= (DISPLAY_HEIGHT
/ 2) - (LOGO_HEIGHT
/ 2);
184 const struct plugin_api
* rb
= api
;
187 #ifdef HAVE_LCD_CHARCELLS
194 #ifdef HAVE_LCD_CHARCELLS
195 if (!pgfx_init(rb
, 4, 2)) {
196 rb
->splash(HZ
*2, "Old LCD :(");
200 rb
->srand(*rb
->current_tick
);
201 dx
= rb
->rand()%(2*RAND_SCALE
+1) - RAND_SCALE
;
202 dy
= rb
->rand()%(2*RAND_SCALE
+1) - RAND_SCALE
;
205 #ifdef HAVE_LCD_BITMAP
206 rb
->lcd_clear_display();
207 rb
->lcd_bitmap(LOGO
, x
, y
, LOGO_WIDTH
, LOGO_HEIGHT
);
209 rb
->lcd_remote_clear_display();
210 rb
->lcd_remote_bitmap(REMOTE_LOGO
,
211 (x
* (REMOTE_WIDTH
- REMOTE_LOGO_WIDTH
)) / (DISPLAY_WIDTH
- LOGO_WIDTH
),
212 (y
* (REMOTE_HEIGHT
- REMOTE_LOGO_HEIGHT
)) / (DISPLAY_HEIGHT
- LOGO_HEIGHT
),
213 REMOTE_LOGO_WIDTH
, REMOTE_LOGO_HEIGHT
);
216 pgfx_clear_display();
217 pgfx_mono_bitmap(LOGO
, x
% 5, y
, LOGO_WIDTH
, LOGO_HEIGHT
);
226 if (x
> DISPLAY_WIDTH
- LOGO_WIDTH
) {
228 x
= DISPLAY_WIDTH
- LOGO_WIDTH
;
236 if (y
> DISPLAY_HEIGHT
- LOGO_HEIGHT
) {
238 y
= DISPLAY_HEIGHT
- LOGO_HEIGHT
;
241 #ifdef HAVE_LCD_BITMAP
244 rb
->lcd_remote_update();
247 if (cpos
!= old_cpos
) {
248 rb
->lcd_clear_display();
249 pgfx_display(cpos
, 0);
256 button
= rb
->button_get(false);
259 #ifdef CONFIG_REMOTE_KEYPAD
262 #ifdef HAVE_LCD_CHARCELLS
267 #ifdef CONFIG_REMOTE_KEYPAD
271 dx
+= (dx
< 0) ? 1 : -1;
274 #ifdef CONFIG_REMOTE_KEYPAD
277 dx
+= (dx
< 0) ? -1 : 1;
280 #ifdef CONFIG_REMOTE_KEYPAD
284 dy
+= (dy
< 0) ? 1 : -1;
287 #ifdef CONFIG_REMOTE_KEYPAD
290 dy
+= (dy
< 0) ? -1 : 1;
294 if (rb
->default_event_handler(button
) == SYS_USB_CONNECTED
) {
295 #ifdef HAVE_LCD_CHARCELLS
298 return PLUGIN_USB_CONNECTED
;