2002-04-27 15:20:53 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Felix Arends
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <process.h>
|
|
|
|
#include "uisw32.h"
|
|
|
|
#include "lcd.h"
|
|
|
|
|
2003-02-19 14:20:16 +00:00
|
|
|
unsigned char lcd_framebuffer[LCD_WIDTH][LCD_HEIGHT/8]; /* the display */
|
2002-08-07 11:10:06 +00:00
|
|
|
char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
|
2002-04-27 15:20:53 +00:00
|
|
|
|
|
|
|
BITMAPINFO2 bmi =
|
|
|
|
{
|
2002-08-02 14:00:52 +00:00
|
|
|
{sizeof (BITMAPINFOHEADER),
|
|
|
|
LCD_WIDTH, -LCD_HEIGHT, 1, 8,
|
|
|
|
BI_RGB, 0, 0, 0, 2, 2,
|
|
|
|
},
|
|
|
|
{
|
2002-09-10 07:19:40 +00:00
|
|
|
{UI_LCD_BGCOLOR, 0}, /* green background color */
|
|
|
|
{UI_LCD_BLACK, 0} /* black color */
|
2002-08-02 14:00:52 +00:00
|
|
|
}
|
|
|
|
|
2002-09-10 07:19:40 +00:00
|
|
|
}; /* bitmap information */
|
2002-04-27 15:20:53 +00:00
|
|
|
|
|
|
|
|
2003-02-27 15:44:26 +00:00
|
|
|
void lcd_set_invert_display(bool invert)
|
|
|
|
{
|
|
|
|
(void)invert;
|
|
|
|
}
|
|
|
|
|
2002-09-10 07:19:40 +00:00
|
|
|
/* lcd_update()
|
|
|
|
update lcd */
|
2002-04-27 15:20:53 +00:00
|
|
|
void lcd_update()
|
|
|
|
{
|
2002-09-10 07:19:40 +00:00
|
|
|
int x, y;
|
2002-04-27 15:20:53 +00:00
|
|
|
if (hGUIWnd == NULL)
|
|
|
|
_endthread ();
|
|
|
|
|
2002-09-10 07:19:40 +00:00
|
|
|
for (x = 0; x < LCD_WIDTH; x++)
|
|
|
|
for (y = 0; y < LCD_HEIGHT; y++)
|
2002-08-07 10:35:26 +00:00
|
|
|
bitmap[y][x] = ((lcd_framebuffer[x][y/8] >> (y & 7)) & 1);
|
2002-04-27 15:20:53 +00:00
|
|
|
|
2002-09-10 07:19:40 +00:00
|
|
|
InvalidateRect (hGUIWnd, NULL, FALSE);
|
2002-04-27 15:20:53 +00:00
|
|
|
|
2002-09-10 07:19:40 +00:00
|
|
|
/* natural sleep :) Bagder: why is this here? */
|
2002-04-27 15:20:53 +00:00
|
|
|
Sleep (50);
|
2002-04-27 17:02:17 +00:00
|
|
|
}
|
|
|
|
|
2002-09-10 07:19:40 +00:00
|
|
|
void lcd_update_rect(int x_start, int y_start,
|
|
|
|
int width, int height)
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
int xmax, ymax;
|
|
|
|
|
|
|
|
ymax = y_start + height;
|
|
|
|
xmax = x_start + width;
|
|
|
|
|
|
|
|
if (hGUIWnd == NULL)
|
|
|
|
_endthread ();
|
|
|
|
|
|
|
|
if(xmax > LCD_WIDTH)
|
|
|
|
xmax = LCD_WIDTH;
|
|
|
|
if(ymax >= LCD_HEIGHT)
|
|
|
|
ymax = LCD_HEIGHT;
|
|
|
|
|
|
|
|
for (x = x_start; x < xmax; x++)
|
|
|
|
for (y = y_start; y < ymax; y++)
|
|
|
|
bitmap[y][x] = ((lcd_framebuffer[x][y/8] >> (y & 7)) & 1);
|
|
|
|
|
|
|
|
/* Bagder: If I only knew how, I would make this call only invalidate
|
|
|
|
the actual rectangle we want updated here, this NULL thing here will
|
|
|
|
make the full rectangle updated! */
|
|
|
|
InvalidateRect (hGUIWnd, NULL, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* lcd_backlight()
|
|
|
|
set backlight state of lcd */
|
|
|
|
void lcd_backlight (bool on)
|
2002-04-27 17:02:17 +00:00
|
|
|
{
|
|
|
|
if (on)
|
|
|
|
{
|
|
|
|
RGBQUAD blon = {UI_LCD_BGCOLORLIGHT, 0};
|
|
|
|
bmi.bmiColors[0] = blon;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RGBQUAD blon = {UI_LCD_BGCOLOR, 0};
|
|
|
|
bmi.bmiColors[0] = blon;
|
|
|
|
}
|
|
|
|
|
2002-09-10 07:19:40 +00:00
|
|
|
InvalidateRect (hGUIWnd, NULL, FALSE);
|
2002-08-02 14:00:52 +00:00
|
|
|
}
|