option Priority for NoritakeVFD (idea: Richard Muratti)

This commit is contained in:
marschap
2007-09-20 15:59:57 +00:00
parent 6c18a1751a
commit 72a98a5068
5 changed files with 44 additions and 6 deletions
+2 -1
View File
@@ -24,7 +24,8 @@ v.0.5dev (ongoing development)
* enable building lcdproc client on FreeBSD AMD64 platform (M. Dolze) * enable building lcdproc client on FreeBSD AMD64 platform (M. Dolze)
* Autoconf fixes for Net/FreeBSD (M. Dolze) * Autoconf fixes for Net/FreeBSD (M. Dolze)
* fixes for the lcpdroc client iface screen on *BSD (M.Dolze) * fixes for the lcpdroc client iface screen on *BSD (M.Dolze)
* key support for hd44780/lcd2usb (M. Dolze) + key support for hd44780/lcd2usb (M. Dolze)
+ option Priority for NoritakeVFD (idea: Richard Muratti)
v.0.5.2 v.0.5.2
* fix switching on/off the Load screen in lcdproc client using the menu * fix switching on/off the Load screen in lcdproc client using the menu
+3
View File
@@ -744,6 +744,9 @@ Brightness=255
# set the serial port speed [default: 9600, legal: 1200, 2400, 9600, 19200, 115200] # set the serial port speed [default: 9600, legal: 1200, 2400, 9600, 19200, 115200]
Speed=9600 Speed=9600
# Set serial data parity [default: 0 (None), legal: 0(=none), 1(=odd), 2(=even)]
Parity=0
# re-initialize VFD ? # re-initialize VFD ?
#Reboot=yes #Reboot=yes
@@ -68,6 +68,24 @@ This section talks about using LCDproc with text mode VFD displays from
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<command>Parity=</command>
<arg choice="plain">
<group choice="req">
<arg choice="plain"><literal><emphasis>0</emphasis></literal></arg>
<arg choice="plain"><literal>1</literal></arg>
<arg choice="plain"><literal>2</literal></arg>
</group>
</arg>
</term>
<listitem><para>
Set the parity for communication with the device to even parity (<literal>2</literal>),
odd parity (<literal>1</literal>) or no parity (<literal>0</literal>).
If not given, it defaults to <literal>0</literal>.
</para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command>Reboot=</command> <command>Reboot=</command>
+18 -3
View File
@@ -53,6 +53,7 @@ typedef struct driver_private_data {
char device[200]; char device[200];
int fd; int fd;
int speed; int speed;
int parity;
/* dimensions */ /* dimensions */
int width, height; int width, height;
int cellwidth, cellheight; int cellwidth, cellheight;
@@ -150,6 +151,17 @@ NoritakeVFD_init (Driver *drvthis)
else if (tmp == 115200) p->speed = B115200; else if (tmp == 115200) p->speed = B115200;
/* Which parity */
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 = (tmp & 1) ? (PARENB | PARODD) : PARENB;
/* Reboot display? */ /* Reboot display? */
reboot = drvthis->config_get_bool(drvthis->name, "Reboot", 0, 0); reboot = drvthis->config_get_bool(drvthis->name, "Reboot", 0, 0);
@@ -164,10 +176,13 @@ NoritakeVFD_init (Driver *drvthis)
tcgetattr(p->fd, &portset); tcgetattr(p->fd, &portset);
// We use RAW mode // We use RAW mode (with varying parity)
#ifdef HAVE_CFMAKERAW #ifdef HAVE_CFMAKERAW
// The easy way // The easy way
cfmakeraw(&portset); cfmakeraw(&portset);
// set parity the way we want it
portset.c_cflag &= ~(PARENB | PARODD);
portset.c_cflag |= p->parity;
#else #else
// The hard way // The hard way
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
@@ -175,7 +190,7 @@ NoritakeVFD_init (Driver *drvthis)
portset.c_oflag &= ~OPOST; portset.c_oflag &= ~OPOST;
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN ); portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS ); portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
portset.c_cflag |= CS8 | CREAD | CLOCAL; portset.c_cflag |= CS8 | CREAD | CLOCAL | p->parity;
#endif #endif
// Set port speed // Set port speed
@@ -356,7 +371,7 @@ NoritakeVFD_autoscroll (Driver *drvthis, int on)
} }
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Get rid of the blinking curson // Get rid of the blinking cursor
// //
static void static void
NoritakeVFD_hidecursor (Driver *drvthis) NoritakeVFD_hidecursor (Driver *drvthis)
+1
View File
@@ -29,6 +29,7 @@
#define DEFAULT_SPEED 9600 #define DEFAULT_SPEED 9600
#define DEFAULT_BRIGHTNESS 140 #define DEFAULT_BRIGHTNESS 140
#define DEFAULT_SIZE "20x4" #define DEFAULT_SIZE "20x4"
#define DEFAULT_PARITY 0
MODULE_EXPORT int NoritakeVFD_init (Driver *drvthis); MODULE_EXPORT int NoritakeVFD_init (Driver *drvthis);
MODULE_EXPORT void NoritakeVFD_close (Driver *drvthis); MODULE_EXPORT void NoritakeVFD_close (Driver *drvthis);