afew doc cleanups, and cleanups /more checks ofr the hd44780 driver

This commit is contained in:
marschap
2007-11-03 20:55:49 +00:00
parent 46347e8c94
commit 3a3a4dc8d9
6 changed files with 57 additions and 42 deletions
+8 -7
View File
@@ -1693,7 +1693,7 @@ and drives both channels as outputs to control the display in 8bit mode.
<entry>BDBUS2</entry>
<entry>38</entry>
<entry></entry>
<entry>E</entry>
<entry>EN</entry>
<entry>6</entry>
</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>
</term>
<listitem><para>
Some displays (e.g. <code>vdr-wakeup</code>) need a message from the driver to that it
is still alive. When set to a value bigger then <literal>0</literal> the character in the
Some displays (e.g. <code>vdr-wakeup</code>) need a message from the driver to
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.
The default <literal>0</literal> does not cause any extra updates.
</para></listitem>
@@ -2600,8 +2601,8 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
</term>
<listitem><para>
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
full screen refresh <replaceable>SECONDS</replaceable> seconds.
option as workaround. If set to a value greater than <literal>0</literal> it forces a
full screen refresh every <replaceable>SECONDS</replaceable> seconds.
Default: <literal>0</literal>.
</para></listitem>
</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>
</term>
<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>.
</para></listitem>
</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>
</term>
<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>.
</para></listitem>
</varlistentry>
+4 -4
View File
@@ -16,8 +16,8 @@
<para>
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
translates the USB protocol to serial expected by the VFD driver chip, an NEC UPD16314. A
programmable interrupt controller (PIC), the PIC16F716 by Microchip, provides the glue
translates the USB protocol to serial expected by the VFD driver chip, an NEC UPD16314.
A programmable interrupt controller (PIC), the PIC16F716 by Microchip, provides the glue
between the FTDI and the NEC chips.
</para>
@@ -78,7 +78,7 @@ can be done by specifying "--enable-drivers=all" or by
<para>
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
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.
</para>
<para>
@@ -98,7 +98,7 @@ can be done by specifying "--enable-drivers=all" or by
<para>
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
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.
</para>
<para>
+2 -2
View File
@@ -406,10 +406,10 @@ const unsigned char SED1278F_0B_charmap[] = {
/* 255 ( 'ÿ' ) */ 253
};
#define MAX_CHARMAP_NAME_LENGHT 16
#define MAX_CHARMAP_NAME_LENGTH 16
struct charmap {
char name[MAX_CHARMAP_NAME_LENGHT];
char name[MAX_CHARMAP_NAME_LENGTH];
const unsigned char *charmap;
};
+3 -3
View File
@@ -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_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);
// Init 1. channel: data
@@ -97,8 +97,8 @@ ftdi_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char fla
exit (-1);
}
// Setup RS and R/W and E
ch = p->ftdi_line_E | p->backlight_bit;
// Setup RS and R/W and EN
ch = p->ftdi_line_EN | p->backlight_bit;
if (flags == RS_DATA) {
ch |= p->ftdi_line_RS;
}
+1 -1
View File
@@ -113,7 +113,7 @@ typedef struct driver_private_data {
int ftdi_line_RS;
int ftdi_line_RW;
int ftdi_line_E;
int ftdi_line_EN;
int ftdi_line_backlight;
#endif
+39 -25
View File
@@ -338,12 +338,12 @@ HD44780_init(Driver *drvthis)
}
// 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);
conf_charmap[MAX_CHARMAP_NAME_LENGHT-1]='\0';
p->charmap=0;
for (i=0; i<(sizeof(available_charmaps)/sizeof(struct charmap)); i++) {
strncpy(conf_charmap, drvthis->config_get_string(drvthis->name, "charmap", 0, "hd44780_default"), MAX_CHARMAP_NAME_LENGTH);
conf_charmap[MAX_CHARMAP_NAME_LENGTH-1] = '\0';
p->charmap = 0;
for (i = 0; i < (sizeof(available_charmaps)/sizeof(struct charmap)); i++) {
if (strcasecmp(conf_charmap, available_charmaps[i].name) == 0) {
p->charmap=i;
break;
@@ -384,6 +384,17 @@ HD44780_init(Driver *drvthis)
if (init_fn(drvthis) != 0)
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
if (p->hd44780_functions->senddata == NULL) {
report(RPT_ERR, "%s: incomplete functions for connection type");
@@ -596,34 +607,32 @@ HD44780_flush(Driver *drvthis)
PrivateData *p = (PrivateData *) drvthis->private_data;
int x, y;
int wid = p->width;
char ch;
char drawing;
int row;
int i;
int count;
char refreshNow = 0;
char keepaliveNow = 0;
time_t now = time(NULL);
// force full refresh of display
if ((p->refreshdisplay > 0) && (time(NULL) > p->nextrefresh))
{
if ((p->refreshdisplay > 0) && (now > p->nextrefresh)) {
refreshNow = 1;
p->nextrefresh = time(NULL) + p->refreshdisplay;
p->nextrefresh = now + p->refreshdisplay;
}
// keepalive refresh of display
if ((p->keepalivedisplay > 0) && (time(NULL) > p->nextkeepalive))
{
if ((p->keepalivedisplay > 0) && (now > p->nextkeepalive)) {
keepaliveNow = 1;
p->nextkeepalive = time(NULL) + p->keepalivedisplay;
p->nextkeepalive = now + p->keepalivedisplay;
}
// Update LCD incrementally by comparing with last contents
count = 0;
for (y = 0; y < p->height; y++) {
drawing = 0;
int drawing = 0;
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 (!drawing || x % 8 == 0) { // x%8 is for 16x1 displays !
drawing = 1;
@@ -645,6 +654,7 @@ HD44780_flush(Driver *drvthis)
count = 0;
for (i = 0; i < NUM_CCs; i++) {
if (!p->cc[i].clean) {
int row;
/* Tell the HD44780 we will redefine char number i */
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;
unsigned char scancode;
char * keystr = NULL;
char *keystr = NULL;
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);
scancode = p->hd44780_functions->scankeypad(p);
if (scancode) {
if (scancode & 0xF0) {
keystr = p->keyMapMatrix[((scancode&0xF0)>>4)-1][(scancode&0x0F)-1];
}
else {
keystr = p->keyMapDirect[scancode - 1];
}
if (scancode != '\0') {
// TODO: check if arrays are large enough
keystr = (scancode & 0xF0)
? p->keyMapMatrix[((scancode&0xF0)>>4)-1][(scancode&0x0F)-1]
: p->keyMapDirect[scancode - 1];
}
if (keystr != NULL) {
@@ -1191,6 +1201,10 @@ unsigned char HD44780_scankeypad(PrivateData *p)
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
// Put all zeros on Y of keypad
keybits = p->hd44780_functions->readkeypad(p, 0);