1 #include "driver_lcd.h"
6 #define LCDDRV_CMD_LCD_CLEAR 'c' /* LCD
\e$B$N>C5n
\e(B */
7 #define LCDDRV_CMD_LCD_DRAW_BOX 'b' /* BOX
\e$BIA2h%3%^%s%I
\e(B */
8 #define LCDDRV_CMD_LCD_DRAW_LOGO 'l' /* LOGO
\e$BIA2h%3%^%s%I
\e(B */
9 #define LCDDRV_CMD_LCD_DRAW_TEXT 't' /* TEXT
\e$BIA2h%3%^%s%I
\e(B */
11 void lcddrv_clear(void)
15 p[0] = LCDDRV_CMD_LCD_CLEAR;
16 kz_send(MSGBOX_ID_LCDDRIVE, 1, p);
19 void lcddrv_draw_box(int x1, int y1, int x2, int y2, int on)
23 p[0] = LCDDRV_CMD_LCD_DRAW_BOX;
29 kz_send(MSGBOX_ID_LCDDRIVE, 6, p);
32 void lcddrv_draw_logo(int x, int y, int size)
36 p[0] = LCDDRV_CMD_LCD_DRAW_LOGO;
40 kz_send(MSGBOX_ID_LCDDRIVE, 4, p);
43 void lcddrv_draw_text(int x, int y, char *str)
48 p = kz_kmalloc(3 + len + 1);
49 p[0] = LCDDRV_CMD_LCD_DRAW_TEXT;
52 memcpy(&p[3], str, len);
54 kz_send(MSGBOX_ID_LCDDRIVE, 3 + len + 1, p);
57 static void draw_logo(const int ofsx, const int ofsy, const int size)
59 static const uint8 logo_40x32[] = {
60 0x00,0x00,0x00,0x00,0x00,
61 0x00,0x00,0x00,0x00,0x00,
62 0x00,0x1f,0xfc,0x00,0x00,
63 0x00,0x1f,0xff,0xc0,0x00,
64 0x00,0x1f,0xff,0xf0,0x00,
65 0x00,0x0f,0x7f,0xfc,0x00,
66 0x00,0x0f,0x7f,0xff,0x00,
67 0x00,0x0f,0x7f,0xff,0xc0,
68 0x00,0x0f,0x7f,0xff,0xe0,
69 0x00,0x07,0x3f,0xff,0xf0,
70 0x00,0x07,0x9f,0xff,0xfc,
71 0x00,0x07,0xc1,0xff,0xfe,
72 0x3f,0xff,0xff,0xff,0xff,
73 0x3f,0xff,0xff,0xff,0xff,
74 0x1f,0xff,0xff,0xff,0xff,
75 0x1f,0xff,0xff,0xff,0xff,
76 0x1f,0xff,0xfc,0xff,0xff,
77 0x1f,0xff,0xf0,0x3f,0xff,
78 0x1f,0xff,0xf0,0x07,0xff,
79 0x1f,0xff,0xe0,0x41,0xff,
80 0x0f,0xff,0xe0,0x21,0xff,
81 0x0f,0xff,0xe2,0x13,0xff,
82 0x07,0xff,0xf1,0x07,0xff,
83 0x07,0xff,0xf8,0x8f,0xff,
84 0x03,0xff,0xf8,0x1f,0xff,
85 0x03,0xff,0xfc,0x3f,0xff,
86 0x01,0xff,0xfc,0x7f,0xff,
87 0x00,0xff,0xfe,0xff,0xff,
88 0x00,0xff,0xff,0xff,0xff,
89 0x00,0x7f,0xff,0xff,0xff,
90 0x00,0x3f,0xff,0xff,0xff,
91 0x00,0x1f,0xff,0xff,0xff,
93 static const uint8 logo_30x24[] = {
119 static const uint8 logo_20x16[] = {
141 for (y = 0; y < 16; y++) {
142 for (x = 0; x < 20; x++) {
144 c = logo_20x16[(y * 3) + (x / 8)];
146 int pix = (c & (1 << (7 - (x % 8)))) ? 1 : 0;
147 sg12232c_set_pixel(ofsx + x, ofsy + y, pix);
152 for (y = 0; y < 24; y++) {
153 for (x = 0; x < 30; x++) {
155 c = logo_30x24[(y * 4) + (x / 8)];
157 int pix = (c & (1 << (7 - (x % 8)))) ? 1 : 0;
158 sg12232c_set_pixel(ofsx + x, ofsy + y, pix);
163 for (y = 0; y < 32; y++) {
164 for (x = 0; x < 40; x++) {
166 c = logo_40x32[(y * 5) + (x / 8)];
168 int pix = (c & (1 << (7 - (x % 8)))) ? 1 : 0;
169 sg12232c_set_pixel(ofsx + x, ofsy + y, pix);
176 /*
\e$B%9%l%C%I$+$i$NMW5a$r=hM}$9$k
\e(B */
177 static int lcddrv_command(char *p)
181 case LCDDRV_CMD_LCD_CLEAR:
184 case LCDDRV_CMD_LCD_DRAW_BOX:
185 sg12232c_draw_box(p[1], p[2], p[3], p[4], p[5]);
187 case LCDDRV_CMD_LCD_DRAW_LOGO:
188 draw_logo(p[1], p[2], p[3]);
190 case LCDDRV_CMD_LCD_DRAW_TEXT:
191 sg12232c_draw_string(p[1], p[2], &p[3], 0);
201 int driver_lcd(int argc, char *argv[])
209 kz_recv(MSGBOX_ID_LCDDRIVE, &size, &p);