fixes for the serial hd44780 subdrivers (Matteo Pillon)

This commit is contained in:
marschap
2007-02-02 16:46:07 +00:00
parent cc5115fe7f
commit f07c8ba7b5
5 changed files with 27 additions and 8 deletions
+1
View File
@@ -28,6 +28,7 @@ v.0.5dev (ongoing development)
* replace obsolete index() by strchr() (Guillaume LECERF) * replace obsolete index() by strchr() (Guillaume LECERF)
* fixes for CwLinux driver (Gideon Tsang) * fixes for CwLinux driver (Gideon Tsang)
+ new ConnectionType vdr-wakeup in hd44780 driver + new ConnectionType vdr-wakeup in hd44780 driver
* fixes for the hd44780-serial drivers (Matteo Pillon)
v.0.5.1 v.0.5.1
+ config file support in lcdproc client (Andrew Foss) + config file support in lcdproc client (Andrew Foss)
+3
View File
@@ -150,6 +150,9 @@ typedef struct hwDependentFns {
// Output "data" to output latch if there is one // Output "data" to output latch if there is one
void (*output) (PrivateData *p, int data); void (*output) (PrivateData *p, int data);
// Close the interface on shutdown
void (*close) (PrivateData *p);
} HD44780_functions; /* for want of a better name :-) */ } HD44780_functions; /* for want of a better name :-) */
+11 -1
View File
@@ -1,6 +1,6 @@
/* /*
* Driver for serial connected hd44780 LCDs * Driver for serial connected hd44780 LCDs
* Copyright (C) 2006 Matteo Pillon <matteo.pillon@gmail.com> * Copyright (C) 2006-2007 Matteo Pillon <matteo.pillon@gmail.com>
* *
* Some parts are based on the original pic-an-lcd driver code * Some parts are based on the original pic-an-lcd driver code
* Copyright (C) 1997, Matthias Prinke <m.prinke@trashcan.mcnet.de> * Copyright (C) 1997, Matthias Prinke <m.prinke@trashcan.mcnet.de>
@@ -121,6 +121,7 @@ static int lastdisplayID;
void serial_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch); void serial_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
void serial_HD44780_backlight (PrivateData *p, unsigned char state); void serial_HD44780_backlight (PrivateData *p, unsigned char state);
unsigned char serial_HD44780_scankeypad (PrivateData *p); unsigned char serial_HD44780_scankeypad (PrivateData *p);
void serial_HD44780_close (PrivateData *p);
// initialize the driver // initialize the driver
int int
@@ -224,6 +225,7 @@ hd_init_serial (Driver *drvthis)
p->hd44780_functions->backlight = serial_HD44780_backlight; p->hd44780_functions->backlight = serial_HD44780_backlight;
if (p->have_keypad) if (p->have_keypad)
p->hd44780_functions->scankeypad = serial_HD44780_scankeypad; p->hd44780_functions->scankeypad = serial_HD44780_scankeypad;
p->hd44780_functions->close = serial_HD44780_close;
/* Do initialization */ /* Do initialization */
if (SERIAL_IF.if_bits == 8) { if (SERIAL_IF.if_bits == 8) {
@@ -298,3 +300,11 @@ serial_HD44780_scankeypad (PrivateData *p)
} }
return 0; return 0;
} }
void
serial_HD44780_close (PrivateData *p)
{
if (SERIAL_IF.end_code)
write(p->fd, &SERIAL_IF.end_code, 1);
close(p->fd);
}
+8 -7
View File
@@ -21,18 +21,19 @@ typedef struct SerialInterface {
char backlight_escape; /* leave to 0 is the interface uses on/off codes */ char backlight_escape; /* leave to 0 is the interface uses on/off codes */
char backlight_off; char backlight_off;
char backlight_on; /* leave these two to 0 is backlight_escape is set */ char backlight_on; /* leave these two to 0 is backlight_escape is set */
char multiple_displays; char multiple_displays;
char end_code; /* code to send on shutdown */
} SerialInterface; } SerialInterface;
/* List of connectiontypes managed by this driver, if you change /* List of connectiontypes managed by this driver, if you change
something here, remember also to change hd44780-drivers.h */ something here, remember also to change hd44780-drivers.h */
static const SerialInterface serial_interfaces[] = { static const SerialInterface serial_interfaces[] = {
/* name instr data v ^ bitrate bits K esc B Besc Boff Bon Multi */ /* name instr data v ^ bitrate bits K esc B Besc Boff Bon Multi End */
{ "picanlcd", 0x11, 0x12, 0x00, 0x20, 9600, 8, 0, 0x00, 0, 0, 0, 0, 0 }, { "picanlcd", 0x11, 0x12, 0x00, 0x20, 9600, 8, 0, 0x00, 0, 0, 0, 0, 0, 0 },
{ "lcdserializer", 0xFE, 0, 0x00, 0x00, 9600, 8, 0, 0x00, 0, 0, 0, 0, 0 }, { "lcdserializer", 0xFE, 0, 0x00, 0x00, 9600, 8, 0, 0x00, 0, 0, 0, 0, 0, 0 },
{ "los-panel", 0xFE, 0, 0x00, 0x00, 9600, 4, 1, 0xFE, 1, 0xFF, 0, 0, 0 }, { "los-panel", 0xFE, 0, 0x00, 0x00, 9600, 4, 1, 0xFE, 1, 0xFF, 0, 0, 0, 0 },
{ "vdr-lcd", 0xFE, 0, 0x00, 0x00, 9600, 4, 0, 0x00, 0, 0, 0, 0, 0 }, { "vdr-lcd", 0xFE, 0, 0x00, 0x00, 9600, 4, 0, 0x00, 0, 0, 0, 0, 0, 0 },
{ "vdr-wakeup", 0xC0, 0xC4, 0xC0, 0xD0, 9600, 4, 0, 0x00, 1, 0, 0xC9, 0xC8, 1 } { "vdr-wakeup", 0xC0, 0xC4, 0xC0, 0xD0, 9600, 4, 0, 0x00, 1, 0, 0xC9, 0xC8, 1, 0xCF }
}; };
/* initialize this particular driver */ /* initialize this particular driver */
+4
View File
@@ -328,6 +328,7 @@ HD44780_init (Driver * drvthis)
p->hd44780_functions->uPause = uPause; p->hd44780_functions->uPause = uPause;
p->hd44780_functions->scankeypad = HD44780_scankeypad; p->hd44780_functions->scankeypad = HD44780_scankeypad;
p->hd44780_functions->output = NULL; p->hd44780_functions->output = NULL;
p->hd44780_functions->close = NULL;
// Do connection type specific display init // Do connection type specific display init
if (connectionMapping[p->connectiontype_index].init_fn(drvthis) != 0) if (connectionMapping[p->connectiontype_index].init_fn(drvthis) != 0)
@@ -409,6 +410,9 @@ HD44780_close(Driver *drvthis)
{ {
PrivateData *p = (PrivateData *) drvthis->private_data; PrivateData *p = (PrivateData *) drvthis->private_data;
if (p->hd44780_functions->close)
p->hd44780_functions->close(p);
if (p != NULL) { if (p != NULL) {
if (p->framebuf) if (p->framebuf)
free(p->framebuf); free(p->framebuf);