48 int rows; /* Height in characters */ |
48 int rows; /* Height in characters */ |
49 int cx; /* Cursor x position */ |
49 int cx; /* Cursor x position */ |
50 int cy; /* Cursor y position */ |
50 int cy; /* Cursor y position */ |
51 Uint8 cgram[8][8]; /* Characters in CGRAM */ |
51 Uint8 cgram[8][8]; /* Characters in CGRAM */ |
52 int control; /* Control register */ |
52 int control; /* Control register */ |
|
53 int backlight; /* Backlight */ |
53 }; |
54 }; |
54 struct slcdDataStruct *slcds [MAX_SLCDS] ; |
55 struct slcdDataStruct *slcds [MAX_SLCDS] ; |
55 |
56 |
56 |
57 |
57 |
58 |
148 |
149 |
149 void slcdPutchar(int fd, Uint8 data) |
150 void slcdPutchar(int fd, Uint8 data) |
150 { |
151 { |
151 struct slcdDataStruct *lcd = slcds [fd]; |
152 struct slcdDataStruct *lcd = slcds [fd]; |
152 |
153 |
153 SDLGui_Char(lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, data, 0); |
154 SDLGui_Char(lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, data, lcd->backlight); |
154 |
155 |
155 if (++lcd->cx == lcd->cols) { |
156 if (++lcd->cx == lcd->cols) { |
156 lcd->cx = 0; |
157 lcd->cx = 0; |
157 if (++lcd->cy == lcd->rows) |
158 if (++lcd->cy == lcd->rows) |
158 lcd->cy = 0; |
159 lcd->cy = 0; |
177 |
178 |
178 va_start(argp, message); |
179 va_start(argp, message); |
179 vsnprintf(buffer, 1023, message, argp); |
180 vsnprintf(buffer, 1023, message, argp); |
180 va_end(argp); |
181 va_end(argp); |
181 slcdPuts(fd, buffer); |
182 slcdPuts(fd, buffer); |
|
183 } |
|
184 |
|
185 |
|
186 |
|
187 void slcdBacklight(int fd, int bl) |
|
188 { |
|
189 struct slcdDataStruct *lcd = slcds [fd]; |
|
190 |
|
191 lcd->backlight = bl; |
182 } |
192 } |
183 |
193 |
184 |
194 |
185 |
195 |
186 int slcdInit(int fd, int x, int y, int w, int h, int cols, int rows) |
196 int slcdInit(int fd, int x, int y, int w, int h, int cols, int rows) |
222 lcd->cy = 0; |
232 lcd->cy = 0; |
223 for (i = 0; i < 8; i++) |
233 for (i = 0; i < 8; i++) |
224 for (j = 0; j < 8; j++) |
234 for (j = 0; j < 8; j++) |
225 lcd->cgram[i][j] = 0; |
235 lcd->cgram[i][j] = 0; |
226 lcd->control = 0; |
236 lcd->control = 0; |
|
237 lcd->backlight = 0; |
227 |
238 |
228 slcds[fd] = lcd; |
239 slcds[fd] = lcd; |
229 |
240 |
230 slcdDisplay(fd, TRUE); |
241 slcdDisplay(fd, TRUE); |
231 slcdCursor(fd, FALSE); |
242 slcdCursor(fd, FALSE); |