3
3
*
4
4
* Driver for Electronic Assembly serial graphic display
5
5
*
6
+ * Copyright (C) 2012 Robert Resch <[email protected] >
6
7
* Copyright (C) 2007 Stefan Gmeiner <[email protected] >
7
8
* Copyright (C) 2005 Michael Reinelt <[email protected] >
8
9
* Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <[email protected] >
46
47
* GE240-7KV24 3 8 no
47
48
* GE240-7KLWV24 3 8 no
48
49
* GE240-6KLWV24 3 8 no
50
+ * KIT160-6 2 8 no
51
+ * KIT160-7 2 8 no
52
+ * KIT240-6 2 8 no
53
+ * KIT240-7 2 8 no
54
+ * KIT320-8 2 8 no
49
55
*
50
56
* Supported protocol commands:
51
57
*
52
58
* Clear
53
59
* Protocol Display Set Output Set Contrast Bitmap Orientation
54
60
* =======================================================================================
55
61
* 1 DL Y(0..7)(0..1) K(0..20) U(x)(y)(w)(h)(...) Vertical
56
- * 2 <ESC>DL -- <ESC>DK(0..63) <ESC>UL(x)(y)(w)(h)(...) Vertical
62
+ * 2 <ESC>DL -- <ESC>DK(0..63) <ESC>UL(x)(y)(w)(h)(...) Horizontal
57
63
* 3 DL Y(0..7)(0..1) -- U(x)(y)(w)(h)(...) Horizontal
58
64
*
59
65
* Bitmap orientation:
@@ -141,6 +147,11 @@ static MODEL Models[] = {
141
147
142
148
/* Protocol 2 models */
143
149
{"GE128-6N9V24" , 128 , 64 , 63 , 40 , 0 , 2 },
150
+ {"KIT160-6" , 160 , 80 , 0 , 0 , 0 , 2 },
151
+ {"KIT160-7" , 160 , 128 , 0 , 0 , 0 , 2 },
152
+ {"KIT240-6" , 240 , 64 , 0 , 0 , 0 , 2 },
153
+ {"KIT240-7" , 240 , 128 , 0 , 0 , 0 , 2 },
154
+ {"KIT320-8" , 320 , 240 , 0 , 0 , 0 , 2 },
144
155
145
156
/* Protocol 3 models */
146
157
{"GE128-7KV24" , 128 , 128 , 0 , 0 , 8 , 3 },
@@ -165,7 +176,7 @@ static int drv_EA232graphic_open(const char *section)
165
176
{
166
177
/* open serial port */
167
178
/* don't mind about device, speed and stuff, this function will take care of */
168
- if (drv_generic_serial_open (section , Name , 0 ) < 0 )
179
+ if (drv_generic_serial_open_handshake (section , Name , 0 ) < 0 )
169
180
return -1 ;
170
181
171
182
return 0 ;
@@ -183,14 +194,14 @@ static int drv_EA232graphic_close(void)
183
194
/* write data to the display */
184
195
static void drv_EA232graphic_send (const char * data , const int len )
185
196
{
186
- drv_generic_serial_write (data , len );
197
+ drv_generic_serial_write_rts (data , len );
187
198
}
188
199
189
200
190
201
/* delete Display */
191
202
static void drv_EA232graphic_clear_display ()
192
203
{
193
- char cmd [3 ];
204
+ char cmd [4 ];
194
205
195
206
switch (Model -> protocol ) {
196
207
case 1 :
@@ -205,6 +216,12 @@ static void drv_EA232graphic_clear_display()
205
216
cmd [1 ] = 'D' ;
206
217
cmd [2 ] = 'L' ;
207
218
drv_EA232graphic_send (cmd , 3 );
219
+ usleep (500000 );
220
+ cmd [0 ] = ESC ;
221
+ cmd [1 ] = 'Q' ;
222
+ cmd [2 ] = 'C' ;
223
+ cmd [3 ] = '0' ;
224
+ drv_EA232graphic_send (cmd , 4 );
208
225
break ;
209
226
default :
210
227
error ("%s: undefined protocol type" , Name );
@@ -218,16 +235,16 @@ static void drv_EA232graphic_clear_display()
218
235
static void drv_EA232graphic_blit (const int row , const int col , const int height , const int width )
219
236
{
220
237
221
- int r , c , l , p ;
238
+ int r , c , l , p , d ;
222
239
char * cmd ;
223
240
224
241
/* calculate length of command */
225
242
l = 0 ;
226
243
switch (Model -> protocol ) {
227
244
case 1 :
228
- case 2 :
229
245
l = ((height + 7 ) / 8 ) * width ;
230
246
break ;
247
+ case 2 :
231
248
case 3 :
232
249
l = ((width + 7 ) / 8 ) * height ;
233
250
break ;
@@ -275,7 +292,6 @@ static void drv_EA232graphic_blit(const int row, const int col, const int height
275
292
/* set pixels */
276
293
switch (Model -> protocol ) {
277
294
case 1 :
278
- case 2 :
279
295
for (r = 0 ; r < height ; r ++ ) {
280
296
for (c = 0 ; c < width ; c ++ ) {
281
297
if (drv_generic_graphic_black (r + row , c + col )) {
@@ -284,6 +300,16 @@ static void drv_EA232graphic_blit(const int row, const int col, const int height
284
300
}
285
301
}
286
302
break ;
303
+ case 2 :
304
+ d = ((width + 7 ) / 8 );
305
+ for (r = 0 ; r < height ; r ++ ) {
306
+ for (c = 0 ; c < width ; c ++ ) {
307
+ if (drv_generic_graphic_black (r + row , c + col )) {
308
+ cmd [(c / 8 ) + (d * r ) + p ] |= (MSB_BYTE >> (c % 8 ));
309
+ }
310
+ }
311
+ }
312
+ break ;
287
313
case 3 :
288
314
for (c = 0 ; c < width ; c ++ ) {
289
315
for (r = 0 ; r < height ; r ++ ) {
0 commit comments