1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Dave Chapman
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
25 #ifdef HAVE_REMOTE_LCD
26 #include "lcd-remote.h"
31 static fb_data main_backdrop
[LCD_HEIGHT
][LCD_WIDTH
] __attribute__ ((aligned (16)));
32 static fb_data wps_backdrop
[LCD_HEIGHT
][LCD_WIDTH
] __attribute__ ((aligned (16)));
34 static fb_data main_backdrop
[LCD_FBHEIGHT
][LCD_FBWIDTH
];
35 static fb_data wps_backdrop
[LCD_FBHEIGHT
][LCD_FBWIDTH
];
38 #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
39 static fb_remote_data remote_wps_backdrop
[LCD_REMOTE_FBHEIGHT
][LCD_REMOTE_FBWIDTH
];
40 static bool remote_wps_backdrop_valid
= false;
43 static bool main_backdrop_valid
= false;
44 static bool wps_backdrop_valid
= false;
46 /* load a backdrop into a buffer */
47 static bool load_backdrop(const char* filename
, fb_data
* backdrop_buffer
)
53 bm
.data
=(char*)backdrop_buffer
;
54 ret
= read_bmp_file(filename
, &bm
, sizeof(main_backdrop
),
55 FORMAT_NATIVE
| FORMAT_DITHER
, NULL
);
57 if ((ret
> 0) && (bm
.width
== LCD_WIDTH
) && (bm
.height
== LCD_HEIGHT
))
67 bool load_main_backdrop(const char* filename
)
69 main_backdrop_valid
= load_backdrop(filename
, &main_backdrop
[0][0]);
70 return main_backdrop_valid
;
73 bool load_wps_backdrop(const char* filename
)
75 wps_backdrop_valid
= load_backdrop(filename
, &wps_backdrop
[0][0]);
76 return wps_backdrop_valid
;
79 void unload_main_backdrop(void)
81 main_backdrop_valid
= false;
84 void unload_wps_backdrop(void)
86 wps_backdrop_valid
= false;
89 void show_main_backdrop(void)
91 lcd_set_backdrop(main_backdrop_valid
? &main_backdrop
[0][0] : NULL
);
94 void show_wps_backdrop(void)
96 /* if no wps backdrop, fall back to main backdrop */
97 if(wps_backdrop_valid
)
99 lcd_set_backdrop(&wps_backdrop
[0][0]);
103 show_main_backdrop();
107 #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
109 static bool load_remote_backdrop(const char* filename
, fb_remote_data
* backdrop_buffer
)
115 bm
.data
=(char*)backdrop_buffer
;
116 ret
= read_bmp_file(filename
, &bm
, sizeof(main_backdrop
),
117 FORMAT_NATIVE
| FORMAT_DITHER
| FORMAT_REMOTE
, NULL
);
119 if ((ret
> 0) && (bm
.width
== LCD_REMOTE_WIDTH
) && (bm
.height
== LCD_REMOTE_HEIGHT
))
129 bool load_remote_wps_backdrop(const char* filename
)
131 remote_wps_backdrop_valid
= load_remote_backdrop(filename
, &remote_wps_backdrop
[0][0]);
132 return remote_wps_backdrop_valid
;
135 void unload_remote_wps_backdrop(void)
137 remote_wps_backdrop_valid
= false;
140 void show_remote_wps_backdrop(void)
142 /* if no wps backdrop, fall back to main backdrop */
143 if(remote_wps_backdrop_valid
)
145 lcd_remote_set_backdrop(&remote_wps_backdrop
[0][0]);
149 show_remote_main_backdrop();
153 void show_remote_main_backdrop(void)
155 lcd_remote_set_backdrop(NULL
);