LCDproc development and user support list

Text archives Help


[Lcdproc] Patches for NoritakeVFD driver


Chronological Thread 
  • From: rick AT ccoz.com (Richard Muratti)
  • Subject: [Lcdproc] Patches for NoritakeVFD driver
  • Date: Sat Sep 15 17:08:02 2007

Hi all,

Made some fixes/changes to the NoritakeVFD driver.
I have attached a diff to lcdproc-0.5.2
Hope you can use the changes.

Cheers
Rick

diff -u -r lcdproc-0.5.2/LCDd.conf lcdproc-0.5.2-rick/LCDd.conf
--- lcdproc-0.5.2/LCDd.conf 2007-04-26 05:56:43.000000000 +1000
+++ lcdproc-0.5.2-rick/LCDd.conf 2007-09-16 02:26:52.000000000 +1000
@@ -709,6 +709,9 @@
# set the serial port speed [default: 9600, legal: 1200, 2400, 9600, 19200,
115200]
Speed=9600

+# Set serial data parity [default: 0 (None), legal: 0(None), 1(Odd), 2(Even)]
+Parity=0
+
# re-initialize VFD ?
#Reboot=yes

diff -u -r lcdproc-0.5.2/server/drivers/NoritakeVFD.c
lcdproc-0.5.2-rick/server/drivers/NoritakeVFD.c
--- lcdproc-0.5.2/server/drivers/NoritakeVFD.c 2007-04-15 00:38:14.000000000
+1000
+++ lcdproc-0.5.2-rick/server/drivers/NoritakeVFD.c 2007-09-16
02:29:34.000000000 +1000
@@ -4,6 +4,28 @@
This source Code is based on CFontz Driver of this package.

2005-08-01 Version 0.1: mostly everything should work (vbar, hbar never
tested)
+
+ Copyright (C) 2007 Richard Muratti
ricacho AT gmail.com
+ 2007-09-16 Version 0.2:
+ Fixed vbar & hbar - Allowed for displays with 2 custom characters
+ Fixed cursor off - 16H - Data sheet for CU20045SCPB has error ->
Cursor Off 14,16,17H
+ Tested with CU40026SCPB-T20A - 40x2 - Hardware Defaults to 19200 8E1
+ Added new config parameter [Parity] to set serial data parity
0(None),1(Odd),2(Even)
+
+
+ CU40026SCPB-T20A SOFTWARE COMMANDS
+ Back Space 08H International Font 18H
+ Horizontal Tab 09H Katakana Font 19H
+ Line Feed 0AH Escape 1BH
+ Form Feed 0CH Send User Font +43H
+ Carriage Return 0DH Position cursor +48H
+ Clear Display 0EH Software Reset +49H
+ Increment Write Mode 11H Luminance +4CH
+ Vertical Scroll Mode 12H Flickerless Write +53H
+ Underline Cursor On 14H Cursor Blink Speed +54H
+ 5x7 Block Cursor On 15H Character Data 20H+
+ Cursor Off 16H User Character Data 00H+

+

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -53,6 +75,7 @@
char device[200];
int fd;
int speed;
+ int parity;
/* dimensions */
int width, height;
int cellwidth, cellheight;
@@ -74,8 +97,8 @@
static void NoritakeVFD_autoscroll (Driver *drvthis, int on);
static void NoritakeVFD_hidecursor (Driver *drvthis);
static void NoritakeVFD_reboot (Driver *drvthis);
-static void NoritakeVFD_init_vbar (Driver *drvthis);
-static void NoritakeVFD_init_hbar (Driver *drvthis);
+static void NoritakeVFD_init_vbar (Driver *drvthis,int len);
+static void NoritakeVFD_init_hbar (Driver *drvthis,int len);
static void NoritakeVFD_draw_frame (Driver *drvthis, unsigned char *dat);
//static void NoritakeVFD_heartbeat (Driver *drvthis, int type);

@@ -150,6 +173,18 @@
else if (tmp == 115200) p->speed = B115200;


+ /* Which protocol */
+ tmp = drvthis->config_get_int(drvthis->name, "Parity", 0,
DEFAULT_PARITY);
+ if ((tmp != 0) && (tmp != 1) && (tmp != 2) ) {
+ report(RPT_WARNING, "%s: Parity must be 0 (None), 1(Odd),
2(Even); using default %d",
+ drvthis->name, DEFAULT_PARITY);
+ tmp = DEFAULT_PARITY;
+ }
+ if (tmp == 0) p->parity = 0;
+ else if (tmp == 1) p->parity = PARENB | PARODD;
+ else if (tmp == 2) p->parity = PARENB;
+
+
/* Reboot display? */
reboot = drvthis->config_get_bool(drvthis->name, "Reboot", 0, 0);

@@ -165,18 +200,18 @@
tcgetattr(p->fd, &portset);

// We use RAW mode
-#ifdef HAVE_CFMAKERAW
+//#ifdef HAVE_CFMAKERAW
// The easy way
cfmakeraw(&portset);
-#else
+//#else
// The hard way
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
| INLCR | IGNCR | ICRNL | IXON );
portset.c_oflag &= ~OPOST;
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
- portset.c_cflag |= CS8 | CREAD | CLOCAL;
-#endif
+ portset.c_cflag |= CS8 | CREAD | CLOCAL | p->parity;
+//#endif

// Set port speed
cfsetospeed(&portset, p->speed);
@@ -356,7 +391,7 @@
}

/////////////////////////////////////////////////////////////////
-// Get rid of the blinking curson
+// Get rid of the blinking cursor
//
static void
NoritakeVFD_hidecursor (Driver *drvthis)
@@ -364,7 +399,7 @@
PrivateData *p = drvthis->private_data;
char out[4];

- snprintf(out, sizeof(out), "%c", 0x14);
+ snprintf(out, sizeof(out), "%c", 0x16);
write(p->fd, out, 1);
}

@@ -379,16 +414,31 @@

snprintf(out, sizeof(out), "%c%c", 0x1B, 'I');
write(p->fd, out, 2);
+
+ //Switch on Flickerless Write
+ snprintf(out, sizeof(out), "%c%c", 0x1B, 0x53);
+ write(p->fd, out, 2);
}

/////////////////////////////////////////////////////////////////
// Sets up for vertical bars. Call before NoritakeVFD->vbar()
+// Some Displays have only 2 custom characters so we only create the custom
char we need based in the len needed
//
static void
-NoritakeVFD_init_vbar (Driver *drvthis)
+NoritakeVFD_init_vbar (Driver *drvthis,int len)
{
PrivateData *p = drvthis->private_data;
- char a[] = {
+ char vert[8][35] = {
+ {
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ },
+ {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
@@ -396,8 +446,8 @@
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
- };
- char b[] = {
+ },
+ {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
@@ -405,8 +455,8 @@
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
- };
- char c[] = {
+ },
+ {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
@@ -414,8 +464,8 @@
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
- };
- char d[] = {
+ },
+ {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
@@ -423,8 +473,8 @@
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
- };
- char e[] = {
+ },
+ {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
@@ -432,8 +482,8 @@
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
- };
- char f[] = {
+ },
+ {
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
@@ -441,27 +491,42 @@
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
1, 1, 1, 1, 1,
- };
+ },
+ {
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ }};

if (p->ccmode != hbar) {
p->ccmode = hbar;
- NoritakeVFD_set_char(drvthis, 2, a);
- NoritakeVFD_set_char(drvthis, 3, b);
- NoritakeVFD_set_char(drvthis, 4, c);
- NoritakeVFD_set_char(drvthis, 5, d);
- NoritakeVFD_set_char(drvthis, 6, e);
- NoritakeVFD_set_char(drvthis, 7, f);
+ NoritakeVFD_set_char(drvthis, 2, vert[len]);
}
}

/////////////////////////////////////////////////////////////////
// Inits horizontal bars...
+// Some Displays have only 2 custom characters so we only create the custom
char we need based in the len needed
//
static void
-NoritakeVFD_init_hbar (Driver *drvthis)
+NoritakeVFD_init_hbar (Driver *drvthis,int len)
{
PrivateData *p = drvthis->private_data;
- char a[] = {
+ char horiz[6][35] = {
+ {
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ },
+ {
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
@@ -469,8 +534,8 @@
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
1, 0, 0, 0, 0,
- };
- char b[] = {
+ },
+ {
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
@@ -478,8 +543,8 @@
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
1, 1, 0, 0, 0,
- };
- char c[] = {
+ },
+ {
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
@@ -487,8 +552,8 @@
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
1, 1, 1, 0, 0,
- };
- char d[] = {
+ },
+ {
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
@@ -496,14 +561,20 @@
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
1, 1, 1, 1, 0,
- };
+ },
+ {
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ }};

if (p->ccmode != hbar) {
p->ccmode = hbar;
- NoritakeVFD_set_char(drvthis, 2, a);
- NoritakeVFD_set_char(drvthis, 3, b);
- NoritakeVFD_set_char(drvthis, 4, c);
- NoritakeVFD_set_char(drvthis, 5, d);
+ NoritakeVFD_set_char(drvthis, 2, horiz[len]);
}
}

@@ -513,21 +584,18 @@
MODULE_EXPORT void
NoritakeVFD_vbar (Driver *drvthis, int x, int y, int len, int promille, int
options)
{
-/* PrivateData *p = drvthis->private_data;
- char map[8] = { 32, 1, 2, 3, 4, 5, 6, 255 };
+ PrivateData *p = drvthis->private_data;

- int y;
for (y = p->height; y > 0 && len > 0; y--) {
if (len >= p->cellheight)
- NoritakeVFD_chr (drvthis, x, y, 255);
- else
- NoritakeVFD_chr (drvthis, x, y, map[len]);
-
+ NoritakeVFD_chr (drvthis, x, y, 0xbe);
+
+ else {
+ NoritakeVFD_init_vbar (drvthis,len);
+ NoritakeVFD_chr (drvthis, x, y,2);
+ }
len -= p->cellheight;
- }*/
-
- NoritakeVFD_init_vbar(drvthis);
- //lib_vbar_static(drvthis, x, y, len, promille, options,
p->cellwidth, 0);
+ }
}

/////////////////////////////////////////////////////////////////
@@ -536,21 +604,17 @@
MODULE_EXPORT void
NoritakeVFD_hbar (Driver *drvthis, int x, int y, int len, int promille, int
options)
{
-/* PrivateData *p = drvthis->private_data;
- char map[5] = { 32, 1, 2, 3, 4 };
+ PrivateData *p = drvthis->private_data;

for (; x <= p->width && len > 0; x++) {
if (len >= p->cellwidth)
- NoritakeVFD_chr (drvthis, x, y, map[4]);
- else
- NoritakeVFD_chr (drvthis, x, y, map[len]);
-
+ NoritakeVFD_chr (drvthis, x, y, 0xbe);
+ else {
+ NoritakeVFD_init_vbar (drvthis,len);
+ NoritakeVFD_chr (drvthis, x, y, 2);
+ }
len -= p->cellwidth;
-
- }*/
-
- NoritakeVFD_init_hbar(drvthis);
- //lib_hbar_static(drvthis, x, y, len, promille, options,
p->cellheight, 0);
+ }
}


diff -u -r lcdproc-0.5.2/server/drivers/NoritakeVFD.h
lcdproc-0.5.2-rick/server/drivers/NoritakeVFD.h
--- lcdproc-0.5.2/server/drivers/NoritakeVFD.h 2007-04-15 00:38:14.000000000
+1000
+++ lcdproc-0.5.2-rick/server/drivers/NoritakeVFD.h 2007-09-16
02:26:23.000000000 +1000
@@ -5,6 +5,28 @@

2005-08-01 Version 0.1: mostly everything should work (vbar, hbar never
tested)

+ Copyright (C) 2007 Richard Muratti
ricacho AT gmail.com
+ 2007-09-16 Version 0.2:
+ Fixed vbar & hbar
+ Fixed cursor off - 16H - Data sheet for CU20045SCPB has error ->
Cursor Off 14,16,17H
+ Tested with CU40026SCPB-T20A - Hardware Defaults to 19200 8E1
+ Added new config parameter [Parity] to set serial data parity
0(None),1(Odd),2(Even)
+
+
+ CU40026SCPB-T20A SOFTWARE COMMANDS
+ Back Space 08H International Font 18H
+ Horizontal Tab 09H Katakana Font 19H
+ Line Feed 0AH Escape 1BH
+ Form Feed 0CH Send User Font +43H
+ Carriage Return 0DH Position cursor +48H
+ Clear Display 0EH Software Reset +49H
+ Increment Write Mode 11H Luminance +4CH
+ Vertical Scroll Mode 12H Flickerless Write +53H
+ Underline Cursor On 14H Cursor Blink Speed +54H
+ 5x7 Block Cursor On 15H Character Data 20H+
+ Cursor Off 16H User Character Data 00H+

+
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -29,6 +51,7 @@
#define DEFAULT_SPEED 9600
#define DEFAULT_BRIGHTNESS 140
#define DEFAULT_SIZE "20x4"
+#define DEFAULT_PARITY 0

MODULE_EXPORT int NoritakeVFD_init (Driver *drvthis);
MODULE_EXPORT void NoritakeVFD_close (Driver *drvthis);



Archive powered by MHonArc 2.6.18.

Top of page