diff options
author | reinelt <> | 2004-05-31 05:38:02 +0000 |
---|---|---|
committer | reinelt <> | 2004-05-31 05:38:02 +0000 |
commit | 9bda912426137fa2fa6c6734f96157d3b20cf4ec (patch) | |
tree | cdf640e43c8a07c9d79278f5e47aefbd142130e2 | |
parent | 98aecd949ebdac587dafe715398dbb06d20afe29 (diff) | |
download | lcd4linux-9bda912426137fa2fa6c6734f96157d3b20cf4ec.tar.gz |
[lcd4linux @ 2004-05-31 05:38:02 by reinelt]
fixed possible bugs with user-defined chars (clear high bits)
thanks to Andy Baxter for debugging the MilfordInstruments driver!
-rw-r--r-- | drv_BeckmannEgle.c | 21 | ||||
-rw-r--r-- | drv_Crystalfontz.c | 25 | ||||
-rw-r--r-- | drv_Cwlinux.c | 9 | ||||
-rw-r--r-- | drv_HD44780.c | 16 | ||||
-rw-r--r-- | drv_M50530.c | 11 | ||||
-rw-r--r-- | drv_MatrixOrbital.c | 18 | ||||
-rw-r--r-- | drv_MilfordInstruments.c | 23 | ||||
-rw-r--r-- | drv_USBLCD.c | 13 |
8 files changed, 94 insertions, 42 deletions
diff --git a/drv_BeckmannEgle.c b/drv_BeckmannEgle.c index c7bb05a..375d7b6 100644 --- a/drv_BeckmannEgle.c +++ b/drv_BeckmannEgle.c @@ -1,4 +1,4 @@ -/* $Id: drv_BeckmannEgle.c,v 1.1 2004/05/28 14:36:10 reinelt Exp $ +/* $Id: drv_BeckmannEgle.c,v 1.2 2004/05/31 05:38:02 reinelt Exp $ * * driver for Beckmann+Egle mini terminals * Copyright 2000 Michael Reinelt <reinelt@eunet.at> @@ -22,6 +22,11 @@ * * * $Log: drv_BeckmannEgle.c,v $ + * Revision 1.2 2004/05/31 05:38:02 reinelt + * + * fixed possible bugs with user-defined chars (clear high bits) + * thanks to Andy Baxter for debugging the MilfordInstruments driver! + * * Revision 1.1 2004/05/28 14:36:10 reinelt * * added drv_BeckmannEgle.c (forgotten at first check in :-) @@ -102,7 +107,7 @@ static void drv_BE_write (int row, int col, unsigned char *data, int len) } -static void drv_BE_defchar (int ascii, unsigned char *buffer) +static void drv_BE_defchar (int ascii, unsigned char *matrix) { int i; char cmd[32]; @@ -111,14 +116,14 @@ static void drv_BE_defchar (int ascii, unsigned char *buffer) p = cmd; *p++ = '\033'; *p++ = '&'; - *p++ = 'T'; // enter transparent mode - *p++ = '\0'; // write cmd - *p++ = 0x40|8*ascii; // write CGRAM + *p++ = 'T'; // enter transparent mode + *p++ = '\0'; // write cmd + *p++ = 0x40|8*ascii; // write CGRAM for (i = 0; i < YRES; i++) { - *p++ = '\1'; // write data - *p++ = buffer[i]; // character bitmap + *p++ = '\1'; // write data + *p++ = matrix[i] & 0x1f; // character bitmap } - *p++ = '\377'; // leave transparent mode + *p++ = '\377'; // leave transparent mode drv_generic_serial_write (cmd, p-cmd); } diff --git a/drv_Crystalfontz.c b/drv_Crystalfontz.c index 1d6d977..f6c7cca 100644 --- a/drv_Crystalfontz.c +++ b/drv_Crystalfontz.c @@ -1,4 +1,4 @@ -/* $Id: drv_Crystalfontz.c,v 1.19 2004/05/30 08:25:50 reinelt Exp $ +/* $Id: drv_Crystalfontz.c,v 1.20 2004/05/31 05:38:02 reinelt Exp $ * * new style driver for Crystalfontz display modules * @@ -23,6 +23,11 @@ * * * $Log: drv_Crystalfontz.c,v $ + * Revision 1.20 2004/05/31 05:38:02 reinelt + * + * fixed possible bugs with user-defined chars (clear high bits) + * thanks to Andy Baxter for debugging the MilfordInstruments driver! + * * Revision 1.19 2004/05/30 08:25:50 reinelt * * Crystalfontz 631 driver finished @@ -413,29 +418,31 @@ static void drv_CF_write3 (int row, int col, unsigned char *data, int len) } -static void drv_CF_defchar1 (int ascii, unsigned char *buffer) +static void drv_CF_defchar1 (int ascii, unsigned char *matrix) { - char cmd[2]="\031n"; // set custom char bitmap + int i; + char cmd[10]="\031n"; // set custom char bitmap // user-defineable chars start at 128, but are defined at 0 cmd[1]=(char)(ascii-CHAR0); - drv_generic_serial_write (cmd, 2); - drv_generic_serial_write (buffer, 8); + for (i = 0; i < 8; i++) { + cmd[i+2] = matrix[i] & 0x3f; + } + drv_generic_serial_write (cmd, 10); } static void drv_CF_defchar23 (int ascii, unsigned char *matrix) { - char buffer[9]; int i; + char buffer[9]; // user-defineable chars start at 128, but are defined at 0 buffer[0] = (char)(ascii-CHAR0); - memcpy(buffer+1, matrix, 8); - + // clear bit 6 and 7 of the bitmap (blinking) for (i = 0; i < 8; i++) { - buffer[1+i] &= 0x3f; + buffer[i+1] = matrix[i] & 0x3f; } drv_CF_send (9, 9, buffer); diff --git a/drv_Cwlinux.c b/drv_Cwlinux.c index 1c6f243..8d7d096 100644 --- a/drv_Cwlinux.c +++ b/drv_Cwlinux.c @@ -1,4 +1,4 @@ -/* $Id: drv_Cwlinux.c,v 1.7 2004/05/28 13:51:42 reinelt Exp $ +/* $Id: drv_Cwlinux.c,v 1.8 2004/05/31 05:38:02 reinelt Exp $ * * new style driver for Cwlinux display modules * @@ -23,6 +23,11 @@ * * * $Log: drv_Cwlinux.c,v $ + * Revision 1.8 2004/05/31 05:38:02 reinelt + * + * fixed possible bugs with user-defined chars (clear high bits) + * thanks to Andy Baxter for debugging the MilfordInstruments driver! + * * Revision 1.7 2004/05/28 13:51:42 reinelt * * ported driver for Beckmann+Egle Mini-Terminals @@ -133,7 +138,7 @@ static void drv_CW1602_defchar (int ascii, unsigned char *buffer) cmd[2]=(char)(ascii+1); for (i=0; i<8; i++) { - cmd[3+i]=buffer[i]; + cmd[3+i] = buffer[i] & 0x1f; } drv_generic_serial_write(cmd,12); usleep(20); // delay for cw1602 to settle the character defined! diff --git a/drv_HD44780.c b/drv_HD44780.c index 4450438..122a158 100644 --- a/drv_HD44780.c +++ b/drv_HD44780.c @@ -1,4 +1,4 @@ -/* $Id: drv_HD44780.c,v 1.22 2004/05/27 03:39:47 reinelt Exp $ +/* $Id: drv_HD44780.c,v 1.23 2004/05/31 05:38:02 reinelt Exp $ * * new style driver for HD44780-based displays * @@ -29,6 +29,11 @@ * * * $Log: drv_HD44780.c,v $ + * Revision 1.23 2004/05/31 05:38:02 reinelt + * + * fixed possible bugs with user-defined chars (clear high bits) + * thanks to Andy Baxter for debugging the MilfordInstruments driver! + * * Revision 1.22 2004/05/27 03:39:47 reinelt * * changed function naming scheme to plugin::function @@ -518,8 +523,15 @@ static void drv_HD_write (int row, int col, unsigned char *data, int len) } -static void drv_HD_defchar (int ascii, unsigned char *buffer) +static void drv_HD_defchar (int ascii, unsigned char *matrix) { + int i; + unsigned char buffer[8]; + + for (i = 0; i < 8; i++) { + buffer[i] = matrix[i] & 0x1f; + } + // define chars on *both* controllers! drv_HD_command (allControllers, 0x40|8*ascii, T_EXEC); drv_HD_data (allControllers, buffer, 8, T_WRCG); diff --git a/drv_M50530.c b/drv_M50530.c index a60ad4c..9787818 100644 --- a/drv_M50530.c +++ b/drv_M50530.c @@ -1,4 +1,4 @@ -/* $Id: drv_M50530.c,v 1.5 2004/05/29 15:53:28 reinelt Exp $ +/* $Id: drv_M50530.c,v 1.6 2004/05/31 05:38:02 reinelt Exp $ * * new style driver for M50530-based displays * @@ -23,6 +23,11 @@ * * * $Log: drv_M50530.c,v $ + * Revision 1.6 2004/05/31 05:38:02 reinelt + * + * fixed possible bugs with user-defined chars (clear high bits) + * thanks to Andy Baxter for debugging the MilfordInstruments driver! + * * Revision 1.5 2004/05/29 15:53:28 reinelt * * M50530: reset parport signals on exit @@ -153,7 +158,7 @@ static void drv_M5_write (int row, int col, unsigned char *data, int len) } -static void drv_M5_defchar (int ascii, unsigned char *buffer) +static void drv_M5_defchar (int ascii, unsigned char *matrix) { int i; @@ -162,7 +167,7 @@ static void drv_M5_defchar (int ascii, unsigned char *buffer) // Fixme: looks like the M50530 cannot control the bottom line // therefore we have only 7 bytes here for (i=0; i<7; i++) { - drv_M5_command (0x100|buffer[i], 20); + drv_M5_command (0x100|(matrix[i] & 0x3f), 20); } } diff --git a/drv_MatrixOrbital.c b/drv_MatrixOrbital.c index 573b683..5a65c54 100644 --- a/drv_MatrixOrbital.c +++ b/drv_MatrixOrbital.c @@ -1,4 +1,4 @@ -/* $Id: drv_MatrixOrbital.c,v 1.24 2004/05/28 13:51:42 reinelt Exp $ +/* $Id: drv_MatrixOrbital.c,v 1.25 2004/05/31 05:38:02 reinelt Exp $ * * new style driver for Matrix Orbital serial display modules * @@ -23,6 +23,11 @@ * * * $Log: drv_MatrixOrbital.c,v $ + * Revision 1.25 2004/05/31 05:38:02 reinelt + * + * fixed possible bugs with user-defined chars (clear high bits) + * thanks to Andy Baxter for debugging the MilfordInstruments driver! + * * Revision 1.24 2004/05/28 13:51:42 reinelt * * ported driver for Beckmann+Egle Mini-Terminals @@ -217,13 +222,16 @@ static void drv_MO_write (int row, int col, unsigned char *data, int len) } -static void drv_MO_defchar (int ascii, unsigned char *buffer) +static void drv_MO_defchar (int ascii, unsigned char *matrix) { - char cmd[3]="\376N"; + int i; + char cmd[11]="\376N"; cmd[2]=(char)ascii; - drv_generic_serial_write (cmd, 3); - drv_generic_serial_write (buffer, 8); + for (i = 0; i < 8; i++) { + cmd[i+3] = matrix[i] & 0x1f; + } + drv_generic_serial_write (cmd, 11); } diff --git a/drv_MilfordInstruments.c b/drv_MilfordInstruments.c index 4cbf9be..d68f3eb 100644 --- a/drv_MilfordInstruments.c +++ b/drv_MilfordInstruments.c @@ -1,4 +1,4 @@ -/* $Id: drv_MilfordInstruments.c,v 1.4 2004/05/31 01:31:01 andy-b Exp $ +/* $Id: drv_MilfordInstruments.c,v 1.5 2004/05/31 05:38:02 reinelt Exp $ * * driver for Milford Instruments 'BPK' piggy-back serial interface board * for standard Hitachi 44780 compatible lcd modules. @@ -27,6 +27,11 @@ * * * $Log: drv_MilfordInstruments.c,v $ + * Revision 1.5 2004/05/31 05:38:02 reinelt + * + * fixed possible bugs with user-defined chars (clear high bits) + * thanks to Andy Baxter for debugging the MilfordInstruments driver! + * * Revision 1.4 2004/05/31 01:31:01 andy-b * * @@ -108,17 +113,17 @@ static void drv_MI_write (int row, int col, unsigned char *data, int len) } -static void drv_MI_defchar (int ascii, unsigned char *buffer) +static void drv_MI_defchar (int ascii, unsigned char *matrix) { int i; - char cmd[2]="\376x"; + char cmd[10]="\376x"; + if (ascii<8) { cmd[1]=(char)(64+ascii*8); for ( i=0; i<8; i++) { - buffer[i]&=0x1f; - }; - drv_generic_serial_write (cmd, 2); - drv_generic_serial_write (buffer, 8); + cmd[i+2] = matrix[i] & 0x1f; + }; + drv_generic_serial_write (cmd, 10); } } @@ -144,7 +149,7 @@ static int drv_MI_start (char *section) Model=i; info ("%s: using model '%s'", Name, Models[Model].name); - if (drv_generic_serial_open(section, Name)<0) return -1; + if (drv_generic_serial_open(section, Name, 0) < 0) return -1; // initialize global variables DROWS = Models[Model].rows; @@ -221,7 +226,7 @@ int drv_MI_init (char *section) return ret; // initialize generic bar driver - if ((ret=drv_generic_text_bar_init())!=0) + if ((ret=drv_generic_text_bar_init(0))!=0) return ret; // add fixed chars to the bar driver diff --git a/drv_USBLCD.c b/drv_USBLCD.c index 1fbad54..17c2cd2 100644 --- a/drv_USBLCD.c +++ b/drv_USBLCD.c @@ -1,4 +1,4 @@ -/* $Id: drv_USBLCD.c,v 1.4 2004/05/26 11:37:36 reinelt Exp $ +/* $Id: drv_USBLCD.c,v 1.5 2004/05/31 05:38:02 reinelt Exp $ * * new style driver for USBLCD displays * @@ -26,6 +26,11 @@ * * * $Log: drv_USBLCD.c,v $ + * Revision 1.5 2004/05/31 05:38:02 reinelt + * + * fixed possible bugs with user-defined chars (clear high bits) + * thanks to Andy Baxter for debugging the MilfordInstruments driver! + * * Revision 1.4 2004/05/26 11:37:36 reinelt * * Curses driver ported. @@ -135,15 +140,15 @@ static void drv_UL_write (int row, int col, unsigned char *data, int len) drv_UL_send(); } -static void drv_UL_defchar (int ascii, unsigned char *buffer) +static void drv_UL_defchar (int ascii, unsigned char *matrix) { int i; drv_UL_command (0x40|8*ascii); for (i = 0; i < 8; i++) { - if(*buffer == 0) *BufPtr++ = 0; - *BufPtr++ = *buffer++; + if(*matrix == 0) *BufPtr++ = 0; + *BufPtr++ = *matrix++ & 0x1f; } drv_UL_send(); |