summaryrefslogtreecommitdiff
path: root/uisimulator/win32/lcd-win32.c
blob: 2330d444c5fbbcf5cd4bc05a33b8fbaa6c1f8e5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/***************************************************************************
 *             __________               __   ___.
 *   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"

//
// simulator specific code
//

// varaibles
unsigned char       display[LCD_WIDTH][LCD_HEIGHT/8]; // the display
char                bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display

BITMAPINFO2 bmi =
{
	sizeof (BITMAPINFOHEADER),
	LCD_WIDTH, -LCD_HEIGHT, 1, 8,
	BI_RGB, 0, 0, 0, 2, 2,
	UI_LCD_BGCOLOR, 0, // green background color
	UI_LCD_BLACK, 0 // black color
}; // bitmap information


// lcd_init
// init lcd controler
void lcd_init()
{
    lcd_clear_display ();
}

// lcd_update
// update lcd
void lcd_update()
{
	int x, y;
    if (hGUIWnd == NULL)
        _endthread ();

	for (x = 0; x < LCD_WIDTH; x++)
		for (y = 0; y < LCD_HEIGHT; y++)
            bitmap[y][x] = ((display[x][y/8] >> (y & 7)) & 1);

	InvalidateRect (hGUIWnd, NULL, FALSE);

    // natural sleep :)
    Sleep (50);
}

// lcd_backlight
// set backlight state of lcd
void lcd_backlight (
                    bool on // switch backlight on or off?
                    )
{
    if (on)
    {
        RGBQUAD blon = {UI_LCD_BGCOLORLIGHT, 0};
        bmi.bmiColors[0] = blon;
    }
    else
    {
        RGBQUAD blon = {UI_LCD_BGCOLOR, 0};
        bmi.bmiColors[0] = blon;
    }

	InvalidateRect (hGUIWnd, NULL, FALSE);
}