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)
* Autoconf fixes for Net/FreeBSD (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
* 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]
Speed=9600
# Set serial data parity [default: 0 (None), legal: 0(=none), 1(=odd), 2(=even)]
Parity=0
# re-initialize VFD ?
#Reboot=yes
@@ -68,6 +68,24 @@ This section talks about using LCDproc with text mode VFD displays from
</para></listitem>
</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>
<term>
<command>Reboot=</command>
+20 -5
View File
@@ -53,6 +53,7 @@ typedef struct driver_private_data {
char device[200];
int fd;
int speed;
int parity;
/* dimensions */
int width, height;
int cellwidth, cellheight;
@@ -150,12 +151,23 @@ NoritakeVFD_init (Driver *drvthis)
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 = drvthis->config_get_bool(drvthis->name, "Reboot", 0, 0);
/* Set up io port correctly, and open it...*/
debug(RPT_DEBUG, "%s: Opening device: %s", __FUNCTION__, p->device);
p->fd = open (p->device, O_RDWR | O_NOCTTY | O_NDELAY);
p->fd = open(p->device, O_RDWR | O_NOCTTY | O_NDELAY);
if (p->fd == -1) {
report(RPT_ERR, "%s: open() of %s failed (%s)", drvthis->name, p->device, strerror(errno));
@@ -164,10 +176,13 @@ NoritakeVFD_init (Driver *drvthis)
tcgetattr(p->fd, &portset);
// We use RAW mode
// We use RAW mode (with varying parity)
#ifdef HAVE_CFMAKERAW
// The easy way
cfmakeraw(&portset);
// set parity the way we want it
portset.c_cflag &= ~(PARENB | PARODD);
portset.c_cflag |= p->parity;
#else
// The hard way
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
@@ -175,8 +190,8 @@ NoritakeVFD_init (Driver *drvthis)
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 +371,7 @@ NoritakeVFD_autoscroll (Driver *drvthis, int on)
}
/////////////////////////////////////////////////////////////////
// Get rid of the blinking curson
// Get rid of the blinking cursor
//
static void
NoritakeVFD_hidecursor (Driver *drvthis)
+1
View File
@@ -29,6 +29,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);