summaryrefslogtreecommitdiff
path: root/uisimulator/lcd.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-03-26 10:06:28 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-03-26 10:06:28 +0000
commitd20e6eee0e483582a40968bff25108c3ed855195 (patch)
treeaec37196db49ed0dc957c2ae8dcb9c12354e7407 /uisimulator/lcd.c
parent643542799e448dc03684efebff5ac61dcd602ee5 (diff)
downloadrockbox-d20e6eee0e483582a40968bff25108c3ed855195.tar.gz
rockbox-d20e6eee0e483582a40968bff25108c3ed855195.zip
generic and specific LCD functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/lcd.c')
-rw-r--r--uisimulator/lcd.c179
1 files changed, 179 insertions, 0 deletions
diff --git a/uisimulator/lcd.c b/uisimulator/lcd.c
new file mode 100644
index 0000000000..0db77e09bb
--- /dev/null
+++ b/uisimulator/lcd.c
@@ -0,0 +1,179 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
11 *
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.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20/*
21 * This file is meant for generic LCD defines and global variables etc.
22 */
23
24#define DISP_X 112 /* Display width in pixels */
25#define DISP_Y 64 /* Display height in pixels */
26
27#define CHAR_X 6 /* Character width in pixels */
28#define CHAR_Y 8 /* Character height in pixels */
29#define COL_MASK 0xff /* Character column pixels changed */
30
31/*
32 * ASCII character generation table
33 *
34 * This contains only the printable characters (0x20-0x7f).
35 * Each row in this table is a 5x8 pixel character pattern.
36 * Each byte is a column of pixels, with the top pixel in the LSB.
37 */
38#define ASCII_MIN 0x20 /* First char in table */
39#define ASCII_MAX 0x7f /* Last char in table */
40
41static const uchar char_gen[ASCII_MAX-ASCII_MIN+1][CHAR_X-1] =
42{
43 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x2f */
44 0x00, 0x00, 0x4f, 0x00, 0x00,
45 0x00, 0x07, 0x00, 0x07, 0x00,
46 0x14, 0x7f, 0x14, 0x7f, 0x14,
47 0x24, 0x2a, 0x7f, 0x2a, 0x12,
48 0x23, 0x13, 0x08, 0x64, 0x62,
49 0x36, 0x49, 0x55, 0x22, 0x50,
50 0x00, 0x05, 0x03, 0x00, 0x00,
51 0x00, 0x1c, 0x22, 0x41, 0x00,
52 0x00, 0x41, 0x22, 0x1c, 0x00,
53 0x14, 0x08, 0x3e, 0x08, 0x14,
54 0x08, 0x08, 0x3e, 0x08, 0x08,
55 0x00, 0xa0, 0x60, 0x00, 0x00,
56 0x08, 0x08, 0x08, 0x08, 0x08,
57 0x00, 0x60, 0x60, 0x00, 0x00,
58 0x20, 0x10, 0x08, 0x04, 0x02,
59
60 0x3e, 0x51, 0x49, 0x45, 0x3e, /* 0x30-0x3f */
61 0x00, 0x42, 0x7f, 0x40, 0x00,
62 0x42, 0x61, 0x51, 0x49, 0x46,
63 0x21, 0x41, 0x45, 0x4b, 0x31,
64 0x18, 0x14, 0x12, 0x7f, 0x10,
65 0x27, 0x45, 0x45, 0x45, 0x39,
66 0x3c, 0x4a, 0x49, 0x49, 0x30,
67 0x01, 0x71, 0x09, 0x05, 0x03,
68 0x36, 0x49, 0x49, 0x49, 0x36,
69 0x06, 0x49, 0x49, 0x29, 0x1e,
70 0x00, 0x6c, 0x6c, 0x00, 0x00,
71 0x00, 0xac, 0x6c, 0x00, 0x00,
72 0x08, 0x14, 0x22, 0x41, 0x00,
73 0x14, 0x14, 0x14, 0x14, 0x14,
74 0x00, 0x41, 0x22, 0x14, 0x08,
75 0x02, 0x01, 0x51, 0x09, 0x06,
76
77 0x32, 0x49, 0x79, 0x41, 0x3e, /* 0x40-0x4f */
78 0x7e, 0x11, 0x11, 0x11, 0x7e,
79 0x7f, 0x49, 0x49, 0x49, 0x36,
80 0x3e, 0x41, 0x41, 0x41, 0x22,
81 0x7f, 0x41, 0x41, 0x22, 0x1c,
82 0x7f, 0x49, 0x49, 0x49, 0x41,
83 0x7f, 0x09, 0x09, 0x09, 0x01,
84 0x3e, 0x41, 0x49, 0x49, 0x7a,
85 0x7f, 0x08, 0x08, 0x08, 0x7f,
86 0x00, 0x41, 0x7f, 0x41, 0x00,
87 0x20, 0x40, 0x41, 0x3f, 0x01,
88 0x7f, 0x08, 0x14, 0x22, 0x41,
89 0x7f, 0x40, 0x40, 0x40, 0x40,
90 0x7f, 0x02, 0x0c, 0x02, 0x7f,
91 0x7f, 0x04, 0x08, 0x10, 0x7f,
92 0x3e, 0x41, 0x41, 0x41, 0x3e,
93
94 0x7f, 0x09, 0x09, 0x09, 0x06, /* 0x50-0x5f */
95 0x3e, 0x41, 0x51, 0x21, 0x5e,
96 0x7f, 0x09, 0x19, 0x29, 0x46,
97 0x46, 0x49, 0x49, 0x49, 0x31,
98 0x01, 0x01, 0x7f, 0x01, 0x01,
99 0x3f, 0x40, 0x40, 0x40, 0x3f,
100 0x1f, 0x20, 0x40, 0x20, 0x1f,
101 0x3f, 0x40, 0x38, 0x40, 0x3f,
102 0x63, 0x14, 0x08, 0x14, 0x63,
103 0x07, 0x08, 0x70, 0x08, 0x07,
104 0x71, 0x51, 0x49, 0x45, 0x43,
105 0x00, 0x7f, 0x41, 0x41, 0x00,
106 0x02, 0x04, 0x08, 0x10, 0x20,
107 0x00, 0x41, 0x41, 0x7f, 0x00,
108 0x04, 0x02, 0x01, 0x02, 0x04,
109 0x40, 0x40, 0x40, 0x40, 0x40,
110
111 0x00, 0x01, 0x02, 0x04, 0x00, /* 0x60-0x6f */
112 0x20, 0x54, 0x54, 0x54, 0x78,
113 0x7f, 0x48, 0x44, 0x44, 0x38,
114 0x38, 0x44, 0x44, 0x44, 0x20,
115 0x38, 0x44, 0x44, 0x48, 0x7f,
116 0x38, 0x54, 0x54, 0x54, 0x18,
117 0x08, 0x7e, 0x09, 0x01, 0x02,
118 0x18, 0xa4, 0xa4, 0xa4, 0x7c,
119 0x7f, 0x08, 0x04, 0x04, 0x78,
120 0x00, 0x44, 0x7d, 0x40, 0x00,
121 0x40, 0x80, 0x84, 0x7d, 0x00,
122 0x7f, 0x10, 0x28, 0x44, 0x00,
123 0x00, 0x41, 0x7f, 0x40, 0x00,
124 0x7c, 0x04, 0x18, 0x04, 0x78,
125 0x7c, 0x08, 0x04, 0x04, 0x78,
126 0x38, 0x44, 0x44, 0x44, 0x38,
127
128 0xfc, 0x24, 0x24, 0x24, 0x18, /* 0x70-0x7f */
129 0x18, 0x24, 0x24, 0x24, 0xfc,
130 0x7c, 0x08, 0x04, 0x04, 0x08,
131 0x48, 0x54, 0x54, 0x54, 0x20,
132 0x04, 0x3f, 0x44, 0x40, 0x20,
133 0x3c, 0x40, 0x40, 0x20, 0x7c,
134 0x1c, 0x20, 0x40, 0x20, 0x1c,
135 0x3c, 0x40, 0x30, 0x40, 0x3c,
136 0x44, 0x28, 0x10, 0x28, 0x44,
137 0x1c, 0xa0, 0xa0, 0xa0, 0x7c,
138 0x44, 0x64, 0x54, 0x4c, 0x44,
139 0x00, 0x08, 0x36, 0x41, 0x00,
140 0x00, 0x00, 0x7f, 0x00, 0x00,
141 0x00, 0x41, 0x36, 0x08, 0x00,
142 0x04, 0x02, 0x04, 0x08, 0x04,
143 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
144};
145
146/*
147 * Memory copy of display bitmap
148 *
149 * This has the same format as the Recorder hardware:
150 * Bits within a byte are arranged veritcally, LSB at top.
151 * Byte 0 is top left, byte 1 is 2nd left, byte DISP_X starts 2nd row.
152 */
153static uchar display[DISP_Y/8][DISP_X];
154
155static uint16 lcd_y; /* Current pixel row */
156static uint16 lcd_x; /* Current pixel column */
157
158/*
159 * Set current x,y position
160 */
161void lcd_position (int x, int y)
162{
163 if (x >= 0 && x < DISP_X && y >= 0 && y < DISP_Y)
164 {
165 lcd_x = x;
166 lcd_y = y;
167 }
168}
169
170/*
171 * Clear the display
172 */
173void lcd_clear (void)
174{
175 lcd_x = 0;
176 lcd_y = 0;
177 memset (display, 0, sizeof display);
178}
179