1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Dave Chapman
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 ****************************************************************************/
23 #ifdef HAVE_REMOTE_LCD
24 #include "lcd-remote.h"
29 static fb_data main_backdrop
[LCD_HEIGHT
][LCD_WIDTH
] __attribute__ ((aligned (16)));
30 static fb_data wps_backdrop
[LCD_HEIGHT
][LCD_WIDTH
] __attribute__ ((aligned (16)));
32 static fb_data main_backdrop
[LCD_FBHEIGHT
][LCD_FBWIDTH
];
33 static fb_data wps_backdrop
[LCD_FBHEIGHT
][LCD_FBWIDTH
];
36 #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
37 static fb_remote_data remote_wps_backdrop
[LCD_REMOTE_FBHEIGHT
][LCD_REMOTE_FBWIDTH
];
38 static bool remote_wps_backdrop_valid
= false;
41 static bool main_backdrop_valid
= false;
42 static bool wps_backdrop_valid
= false;
44 /* load a backdrop into a buffer */
45 static bool load_backdrop(const char* filename
, fb_data
* backdrop_buffer
)
51 bm
.data
=(char*)backdrop_buffer
;
52 ret
= read_bmp_file(filename
, &bm
, sizeof(main_backdrop
),
53 FORMAT_NATIVE
| FORMAT_DITHER
);
55 if ((ret
> 0) && (bm
.width
== LCD_WIDTH
) && (bm
.height
== LCD_HEIGHT
))
65 bool load_main_backdrop(const char* filename
)
67 main_backdrop_valid
= load_backdrop(filename
, &main_backdrop
[0][0]);
68 return main_backdrop_valid
;
71 bool load_wps_backdrop(const char* filename
)
73 wps_backdrop_valid
= load_backdrop(filename
, &wps_backdrop
[0][0]);
74 return wps_backdrop_valid
;
77 void unload_main_backdrop(void)
79 main_backdrop_valid
= false;
82 void unload_wps_backdrop(void)
84 wps_backdrop_valid
= false;
87 void show_main_backdrop(void)
89 lcd_set_backdrop(main_backdrop_valid
? &main_backdrop
[0][0] : NULL
);
92 void show_wps_backdrop(void)
94 /* if no wps backdrop, fall back to main backdrop */
95 if(wps_backdrop_valid
)
97 lcd_set_backdrop(&wps_backdrop
[0][0]);
101 show_main_backdrop();
105 #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
107 static bool load_remote_backdrop(const char* filename
, fb_remote_data
* backdrop_buffer
)
113 bm
.data
=(char*)backdrop_buffer
;
114 ret
= read_bmp_file(filename
, &bm
, sizeof(main_backdrop
),
115 FORMAT_NATIVE
| FORMAT_DITHER
| FORMAT_REMOTE
);
117 if ((ret
> 0) && (bm
.width
== LCD_REMOTE_WIDTH
) && (bm
.height
== LCD_REMOTE_HEIGHT
))
127 bool load_remote_wps_backdrop(const char* filename
)
129 remote_wps_backdrop_valid
= load_remote_backdrop(filename
, &remote_wps_backdrop
[0][0]);
130 return remote_wps_backdrop_valid
;
133 void unload_remote_wps_backdrop(void)
135 remote_wps_backdrop_valid
= false;
138 void show_remote_wps_backdrop(void)
140 /* if no wps backdrop, fall back to main backdrop */
141 if(remote_wps_backdrop_valid
)
143 lcd_remote_set_backdrop(&remote_wps_backdrop
[0][0]);
147 show_remote_main_backdrop();
151 void show_remote_main_backdrop(void)
153 lcd_remote_set_backdrop(NULL
);