afew doc cleanups, and cleanups /more checks ofr the hd44780 driver
This commit is contained in:
@@ -1693,7 +1693,7 @@ and drives both channels as outputs to control the display in 8bit mode.
|
|||||||
<entry>BDBUS2</entry>
|
<entry>BDBUS2</entry>
|
||||||
<entry>38</entry>
|
<entry>38</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>E</entry>
|
<entry>EN</entry>
|
||||||
<entry>6</entry>
|
<entry>6</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -2586,8 +2586,9 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
|
|||||||
<arg choice="plain"><replaceable>SECONDS</replaceable></arg>
|
<arg choice="plain"><replaceable>SECONDS</replaceable></arg>
|
||||||
</term>
|
</term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
Some displays (e.g. <code>vdr-wakeup</code>) need a message from the driver to that it
|
Some displays (e.g. <code>vdr-wakeup</code>) need a message from the driver to
|
||||||
is still alive. When set to a value bigger then <literal>0</literal> the character in the
|
indicate that it is still alive.
|
||||||
|
When set to a value greater than <literal>0</literal> the character in the
|
||||||
upper left corner is updated every <replaceable>SECONDS</replaceable> seconds.
|
upper left corner is updated every <replaceable>SECONDS</replaceable> seconds.
|
||||||
The default <literal>0</literal> does not cause any extra updates.
|
The default <literal>0</literal> does not cause any extra updates.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
@@ -2600,8 +2601,8 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
|
|||||||
</term>
|
</term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
If you experience occasional garbage on your display you can use this
|
If you experience occasional garbage on your display you can use this
|
||||||
option as workaround. If set to a value bigger than <literal>0</literal> it forces a
|
option as workaround. If set to a value greater than <literal>0</literal> it forces a
|
||||||
full screen refresh <replaceable>SECONDS</replaceable> seconds.
|
full screen refresh every <replaceable>SECONDS</replaceable> seconds.
|
||||||
Default: <literal>0</literal>.
|
Default: <literal>0</literal>.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -2637,7 +2638,7 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
|
|||||||
<arg choice="plain"><replaceable>VENDORID</replaceable></arg>
|
<arg choice="plain"><replaceable>VENDORID</replaceable></arg>
|
||||||
</term>
|
</term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
USB vendor ID to look for a FTDI chip.
|
USB vendor ID to look for a FTDI chip with <command>ConnectionType=</command><literal>ftdi</literal>.
|
||||||
Default: <literal>0x4003</literal>.
|
Default: <literal>0x4003</literal>.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -2648,7 +2649,7 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
|
|||||||
<arg choice="plain"><replaceable>PRODUCTID</replaceable></arg>
|
<arg choice="plain"><replaceable>PRODUCTID</replaceable></arg>
|
||||||
</term>
|
</term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
USB product ID to look for a FTDI chip.
|
USB product ID to look for a FTDI chip with <command>ConnectionType=</command><literal>ftdi</literal>.
|
||||||
Default: <literal>0x6001</literal>.
|
Default: <literal>0x6001</literal>.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
<para>
|
<para>
|
||||||
This device uses a vacuum flourescent display of 20 characters by 2 lines. Each each
|
This device uses a vacuum flourescent display of 20 characters by 2 lines. Each each
|
||||||
character is 5 pixels wide by 8 pixels high. The device is connected by USB. The FTDI chip
|
character is 5 pixels wide by 8 pixels high. The device is connected by USB. The FTDI chip
|
||||||
translates the USB protocol to serial expected by the VFD driver chip, an NEC UPD16314. A
|
translates the USB protocol to serial expected by the VFD driver chip, an NEC UPD16314.
|
||||||
programmable interrupt controller (PIC), the PIC16F716 by Microchip, provides the glue
|
A programmable interrupt controller (PIC), the PIC16F716 by Microchip, provides the glue
|
||||||
between the FTDI and the NEC chips.
|
between the FTDI and the NEC chips.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ can be done by specifying "--enable-drivers=all" or by
|
|||||||
<para>
|
<para>
|
||||||
The USB Vendor ID of the device to use.
|
The USB Vendor ID of the device to use.
|
||||||
If not given, it defaults to <literal>0x0403</literal> for a VLSystems L.I.S. MCE 2005 VFD
|
If not given, it defaults to <literal>0x0403</literal> for a VLSystems L.I.S. MCE 2005 VFD
|
||||||
based on a FT232BL USB-to-RS232 converter by FTDIi, which was produced
|
based on a FT232BL USB-to-RS232 converter by FTDI, which was produced
|
||||||
before March 2007.
|
before March 2007.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
@@ -98,7 +98,7 @@ can be done by specifying "--enable-drivers=all" or by
|
|||||||
<para>
|
<para>
|
||||||
The USB Product ID of the device to use.
|
The USB Product ID of the device to use.
|
||||||
If not given, it defaults to <literal>0x6001</literal> for a VLSystems L.I.S. MCE 2005 VFD
|
If not given, it defaults to <literal>0x6001</literal> for a VLSystems L.I.S. MCE 2005 VFD
|
||||||
based on a FT232BL USB-to-RS232 converter by FTDIi, which was produced
|
based on a FT232BL USB-to-RS232 converter by FTDI, which was produced
|
||||||
before March 2007.
|
before March 2007.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
|||||||
@@ -406,10 +406,10 @@ const unsigned char SED1278F_0B_charmap[] = {
|
|||||||
/* 255 ( 'ÿ' ) */ 253
|
/* 255 ( 'ÿ' ) */ 253
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_CHARMAP_NAME_LENGHT 16
|
#define MAX_CHARMAP_NAME_LENGTH 16
|
||||||
|
|
||||||
struct charmap {
|
struct charmap {
|
||||||
char name[MAX_CHARMAP_NAME_LENGHT];
|
char name[MAX_CHARMAP_NAME_LENGTH];
|
||||||
const unsigned char *charmap;
|
const unsigned char *charmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ hd_init_ftdi(Driver *drvthis)
|
|||||||
|
|
||||||
p->ftdi_line_RS = drvthis->config_get_int(drvthis->name, "ftdi_line_RS", 0, 0x01);
|
p->ftdi_line_RS = drvthis->config_get_int(drvthis->name, "ftdi_line_RS", 0, 0x01);
|
||||||
p->ftdi_line_RW = drvthis->config_get_int(drvthis->name, "ftdi_line_RW", 0, 0x02);
|
p->ftdi_line_RW = drvthis->config_get_int(drvthis->name, "ftdi_line_RW", 0, 0x02);
|
||||||
p->ftdi_line_E = drvthis->config_get_int(drvthis->name, "ftdi_line_E", 0, 0x04);
|
p->ftdi_line_EN = drvthis->config_get_int(drvthis->name, "ftdi_line_EN", 0, 0x04);
|
||||||
p->ftdi_line_backlight = drvthis->config_get_int(drvthis->name, "ftdi_line_backlight", 0, 0x08);
|
p->ftdi_line_backlight = drvthis->config_get_int(drvthis->name, "ftdi_line_backlight", 0, 0x08);
|
||||||
|
|
||||||
// Init 1. channel: data
|
// Init 1. channel: data
|
||||||
@@ -97,8 +97,8 @@ ftdi_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char fla
|
|||||||
exit (-1);
|
exit (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup RS and R/W and E
|
// Setup RS and R/W and EN
|
||||||
ch = p->ftdi_line_E | p->backlight_bit;
|
ch = p->ftdi_line_EN | p->backlight_bit;
|
||||||
if (flags == RS_DATA) {
|
if (flags == RS_DATA) {
|
||||||
ch |= p->ftdi_line_RS;
|
ch |= p->ftdi_line_RS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ typedef struct driver_private_data {
|
|||||||
|
|
||||||
int ftdi_line_RS;
|
int ftdi_line_RS;
|
||||||
int ftdi_line_RW;
|
int ftdi_line_RW;
|
||||||
int ftdi_line_E;
|
int ftdi_line_EN;
|
||||||
int ftdi_line_backlight;
|
int ftdi_line_backlight;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+39
-25
@@ -338,12 +338,12 @@ HD44780_init(Driver *drvthis)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get configured charmap
|
// Get configured charmap
|
||||||
char conf_charmap[MAX_CHARMAP_NAME_LENGHT];
|
char conf_charmap[MAX_CHARMAP_NAME_LENGTH];
|
||||||
|
|
||||||
strncpy(conf_charmap, drvthis->config_get_string(drvthis->name, "charmap", 0, "hd44780_default"), MAX_CHARMAP_NAME_LENGHT);
|
strncpy(conf_charmap, drvthis->config_get_string(drvthis->name, "charmap", 0, "hd44780_default"), MAX_CHARMAP_NAME_LENGTH);
|
||||||
conf_charmap[MAX_CHARMAP_NAME_LENGHT-1]='\0';
|
conf_charmap[MAX_CHARMAP_NAME_LENGTH-1] = '\0';
|
||||||
p->charmap=0;
|
p->charmap = 0;
|
||||||
for (i=0; i<(sizeof(available_charmaps)/sizeof(struct charmap)); i++) {
|
for (i = 0; i < (sizeof(available_charmaps)/sizeof(struct charmap)); i++) {
|
||||||
if (strcasecmp(conf_charmap, available_charmaps[i].name) == 0) {
|
if (strcasecmp(conf_charmap, available_charmaps[i].name) == 0) {
|
||||||
p->charmap=i;
|
p->charmap=i;
|
||||||
break;
|
break;
|
||||||
@@ -384,6 +384,17 @@ HD44780_init(Driver *drvthis)
|
|||||||
if (init_fn(drvthis) != 0)
|
if (init_fn(drvthis) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
// consistency check: local keypad functions missing => no keypad
|
||||||
|
if ((p->hd44780_functions->readkeypad == NULL) &&
|
||||||
|
(p->hd44780_functions->scankeypad == HD44780_scankeypad)) {
|
||||||
|
p->hd44780_functions->scankeypad = NULL;
|
||||||
|
p->have_keypad = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// consistency check: no local output function => no output
|
||||||
|
if (p->hd44780_functions->output == NULL)
|
||||||
|
p->have_output = 0;
|
||||||
|
|
||||||
// fail if local senddata function was not defined
|
// fail if local senddata function was not defined
|
||||||
if (p->hd44780_functions->senddata == NULL) {
|
if (p->hd44780_functions->senddata == NULL) {
|
||||||
report(RPT_ERR, "%s: incomplete functions for connection type");
|
report(RPT_ERR, "%s: incomplete functions for connection type");
|
||||||
@@ -596,34 +607,32 @@ HD44780_flush(Driver *drvthis)
|
|||||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
int x, y;
|
int x, y;
|
||||||
int wid = p->width;
|
int wid = p->width;
|
||||||
char ch;
|
|
||||||
char drawing;
|
|
||||||
int row;
|
|
||||||
int i;
|
int i;
|
||||||
int count;
|
int count;
|
||||||
char refreshNow = 0;
|
char refreshNow = 0;
|
||||||
char keepaliveNow = 0;
|
char keepaliveNow = 0;
|
||||||
|
time_t now = time(NULL);
|
||||||
|
|
||||||
// force full refresh of display
|
// force full refresh of display
|
||||||
if ((p->refreshdisplay > 0) && (time(NULL) > p->nextrefresh))
|
if ((p->refreshdisplay > 0) && (now > p->nextrefresh)) {
|
||||||
{
|
|
||||||
refreshNow = 1;
|
refreshNow = 1;
|
||||||
p->nextrefresh = time(NULL) + p->refreshdisplay;
|
p->nextrefresh = now + p->refreshdisplay;
|
||||||
}
|
}
|
||||||
// keepalive refresh of display
|
// keepalive refresh of display
|
||||||
if ((p->keepalivedisplay > 0) && (time(NULL) > p->nextkeepalive))
|
if ((p->keepalivedisplay > 0) && (now > p->nextkeepalive)) {
|
||||||
{
|
|
||||||
keepaliveNow = 1;
|
keepaliveNow = 1;
|
||||||
p->nextkeepalive = time(NULL) + p->keepalivedisplay;
|
p->nextkeepalive = now + p->keepalivedisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update LCD incrementally by comparing with last contents
|
// Update LCD incrementally by comparing with last contents
|
||||||
count = 0;
|
count = 0;
|
||||||
for (y = 0; y < p->height; y++) {
|
for (y = 0; y < p->height; y++) {
|
||||||
drawing = 0;
|
int drawing = 0;
|
||||||
|
|
||||||
for (x = 0 ; x < wid; x++) {
|
for (x = 0 ; x < wid; x++) {
|
||||||
ch = p->framebuf[(y * wid) + x];
|
char ch = p->framebuf[(y * wid) + x];
|
||||||
|
|
||||||
if (refreshNow || (x + y == 0 && keepaliveNow) || ch != p->lcd_contents[(y*wid)+x]) {
|
if (refreshNow || (x + y == 0 && keepaliveNow) || ch != p->lcd_contents[(y*wid)+x]) {
|
||||||
if (!drawing || x % 8 == 0) { // x%8 is for 16x1 displays !
|
if (!drawing || x % 8 == 0) { // x%8 is for 16x1 displays !
|
||||||
drawing = 1;
|
drawing = 1;
|
||||||
@@ -645,6 +654,7 @@ HD44780_flush(Driver *drvthis)
|
|||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < NUM_CCs; i++) {
|
for (i = 0; i < NUM_CCs; i++) {
|
||||||
if (!p->cc[i].clean) {
|
if (!p->cc[i].clean) {
|
||||||
|
int row;
|
||||||
|
|
||||||
/* Tell the HD44780 we will redefine char number i */
|
/* Tell the HD44780 we will redefine char number i */
|
||||||
p->hd44780_functions->senddata(p, 0, RS_INSTR, SETCHAR | i * 8);
|
p->hd44780_functions->senddata(p, 0, RS_INSTR, SETCHAR | i * 8);
|
||||||
@@ -1133,21 +1143,21 @@ HD44780_get_key(Driver *drvthis)
|
|||||||
{
|
{
|
||||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
unsigned char scancode;
|
unsigned char scancode;
|
||||||
char * keystr = NULL;
|
char *keystr = NULL;
|
||||||
struct timeval curr_time, time_diff;
|
struct timeval curr_time, time_diff;
|
||||||
|
|
||||||
if (!p->have_keypad) return NULL;
|
// return "no key pressed" if required functions mission or input disabled
|
||||||
|
if ((!p->have_keypad) || (p->hd44780_functions->scankeypad == NULL))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
gettimeofday(&curr_time, NULL);
|
gettimeofday(&curr_time, NULL);
|
||||||
|
|
||||||
scancode = p->hd44780_functions->scankeypad(p);
|
scancode = p->hd44780_functions->scankeypad(p);
|
||||||
if (scancode) {
|
if (scancode != '\0') {
|
||||||
if (scancode & 0xF0) {
|
// TODO: check if arrays are large enough
|
||||||
keystr = p->keyMapMatrix[((scancode&0xF0)>>4)-1][(scancode&0x0F)-1];
|
keystr = (scancode & 0xF0)
|
||||||
}
|
? p->keyMapMatrix[((scancode&0xF0)>>4)-1][(scancode&0x0F)-1]
|
||||||
else {
|
: p->keyMapDirect[scancode - 1];
|
||||||
keystr = p->keyMapDirect[scancode - 1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keystr != NULL) {
|
if (keystr != NULL) {
|
||||||
@@ -1191,6 +1201,10 @@ unsigned char HD44780_scankeypad(PrivateData *p)
|
|||||||
|
|
||||||
unsigned char scancode = 0;
|
unsigned char scancode = 0;
|
||||||
|
|
||||||
|
// return "no ke pressed if no keypad reading function defined
|
||||||
|
if (p->hd44780_functions->readkeypad == NULL)
|
||||||
|
return('\0');
|
||||||
|
|
||||||
// First check if a directly connected key is pressed
|
// First check if a directly connected key is pressed
|
||||||
// Put all zeros on Y of keypad
|
// Put all zeros on Y of keypad
|
||||||
keybits = p->hd44780_functions->readkeypad(p, 0);
|
keybits = p->hd44780_functions->readkeypad(p, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user