diff --git a/ChangeLog b/ChangeLog index 1ec6aa8..fd0c4b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ v.0.5dev (ongoing development) * Modify serial drivers to use cfmakeraw + hd44780: Add a 'none' charmap which does not replace any character * hd44780: Change mapping for spanish 'n with tilde' characters + * hd44780: Exclude pin for switchable backlight from keypad scanning v0.5.3 + lcdexec: notification when called program finishes diff --git a/docs/lcdproc-user/drivers/hd44780.docbook b/docs/lcdproc-user/drivers/hd44780.docbook index 78eea10..64b8f5a 100644 --- a/docs/lcdproc-user/drivers/hd44780.docbook +++ b/docs/lcdproc-user/drivers/hd44780.docbook @@ -827,6 +827,7 @@ The optional keypad can be connected as follows: printer port <-> keypad + remarks name @@ -840,42 +841,49 @@ The optional keypad can be connected as follows: 2 Y1 + D1 3 Y2 + D2 4 Y3 + D3 5 Y4 + D4 6 Y5 + D5 7 Y6 + Only if not used for backlight or 3rd controller. nSTRB 1 Y7 + Only if not used for additional controllers. nLF @@ -900,30 +908,35 @@ The optional keypad can be connected as follows: 10 X1 + BUSY 11 X2 + PAPEREND 12 X3 + SELIN 13 X4 + nFAULT 15 X5 + @@ -1407,7 +1420,7 @@ The optional keypad can be connected as follows: nSEL 17 - Y10 + Y10 (only if not used for backlight) nACK @@ -1858,6 +1871,106 @@ The wiring of the control lines can optionally be reconfigured, please look at the driver source if you really need that. + +Alternatively you can use a single channel FTDI FT245BM USB <-> parallel +FIFO chip and use the display in its 4 bit mode. + + + +HD44780: 4bit FTDI + + + + + + + + + FTDI chip + <-> + LCD + + + name + pin + name + pin + + + + + D0 + 25 + + D4 + 11 + + + D1 + 24 + + D5 + 12 + + + D2 + 23 + + D6 + 13 + + + D3 + 22 + + D7 + 14 + + + D4 + 21 + + EN + 6 + + + D5 + 20 + + RS + 4 + + + D6 + 19 + + RW + 5 + + + +
+ + +The following special configuration settings are required to use a single +channel FTDI FIFO chip: + + + +HD44780: Configuration for FTDI 4bit + + + + + + @@ -2706,7 +2819,8 @@ This can be done by specifying or by inclu hd44780_default | hd44780_euro | ea_ks0073 | - sed12780f_0b + sed12780f_0b | + none } @@ -2729,6 +2843,12 @@ This can be done by specifying or by inclu sed12780f_0b is for some SED 1278 displays. + + The none charmap does not translate any characters. + It displays the characters the display controllers actually has + stored in its CGROM for that position instead. This setting is + intended for debugging purpose. + You only need to set this parameter if you have a non-standard HD44780 display. diff --git a/server/drivers/hd44780-4bit.c b/server/drivers/hd44780-4bit.c index 18a042c..58f761e 100644 --- a/server/drivers/hd44780-4bit.c +++ b/server/drivers/hd44780-4bit.c @@ -34,19 +34,29 @@ * Keypad connection (optional): * Some diodes and resistors are needed, see further documentation. * printer port keypad - * D0 (2) Y0 - * D1 (3) Y1 - * D2 (4) Y2 - * D3 (5) Y3 - * D4 (6) Y4 - * D5 (7) Y5 + * D0 (2) Y1 + * D1 (3) Y2 + * D2 (4) Y3 + * D3 (5) Y4 + * D4 (6) Y5 + * + * With a backlight or three displays, 4 additional rows are possible: * nSTRB (1) Y6 * nLF (14) Y7 * INIT (16) Y8 * nSEL (17) Y9 + * + * With only two controllers and no backlight, 5 additional rows are possible: + * D5 (7) Y6 + * nSTRB (1) Y7 + * nLF (14) Y8 + * INIT (16) Y9 + * nSEL (17) Y10 + * + * Colums return lines are the same for all configurations: * nACK (10) X0 * BUSY (11) X1 - * PAPEREND (12 X2 + * PAPEREND (12) X2 * SELIN (13) X3 * nFAULT (15) X4 * @@ -125,7 +135,7 @@ hd_init_4bit(Driver *drvthis) port_out(p->port, 0x03); if (p->delayBus) hd44780_functions->uPause(p, 1); - /* We'll now send 0x03 a coulpe of times, + /* We'll now send 0x03 a coulpe of times, * which is in fact (FUNCSET | IF_8BIT) >> 4 */ port_out(p->port, enableLines | 0x03); port_out(p->port + 2, ALLEXT ^ OUTMASK); @@ -268,22 +278,35 @@ unsigned char lcdstat_HD44780_readkeypad(PrivateData *p, unsigned int YData) { unsigned char readval; - // 10 bits output or 6 bits if >=3 displays - // Convert the positive logic to the negative logic on the LPT port - port_out(p->port, ~YData & 0x003F); - if (p->numDisplays<=3) { - // Can't combine >3 displays with >6 keypad output lines + /* If at most two controllers and NO backlight, 10 bits may be used */ + if ((p->numDisplays <= 2) && (!p->have_backlight)) { + port_out(p->port, ~YData & 0x003F); port_out(p->port + 2, (((~YData & 0x03C0) >> 6)) ^ OUTMASK); } + else { + /* + * Else ignore D5, because it may be either backlight or EN3. + * Note: If three displays are used, have_backlight must be + * set to 'no' in the config. + */ + port_out(p->port, (~YData & 0x001F) | p->backlight_bit); + /* + * With at most three controllers or backlight 9 bits may be + * used. + */ + if (p->numDisplays<=3) { + port_out(p->port + 2, (((~YData & 0x01E0) >> 5)) ^ OUTMASK); + } + } if (p->delayBus) p->hd44780_functions->uPause(p, 1); - // Read inputs + /* Read inputs */ readval = ~ port_in(p->port + 1) ^ INMASK; - // Put port back into idle state for backlight + /* Put port back into idle state for backlight */ port_out(p->port, p->backlight_bit); - // And convert value back (MSB first). + /* And convert value back (MSB first) */ return (((readval & FAULT) / FAULT <<4) | /* pin 15 */ ((readval & SELIN) / SELIN <<3) | /* pin 13 */ ((readval & PAPEREND) / PAPEREND <<2) | /* pin 12 */ diff --git a/server/drivers/hd44780-ext8bit.c b/server/drivers/hd44780-ext8bit.c index c437208..a7a45d1 100644 --- a/server/drivers/hd44780-ext8bit.c +++ b/server/drivers/hd44780-ext8bit.c @@ -27,21 +27,21 @@ * Keypad connection (optional): * Some diodes and resistors are needed, see further documentation. * printer port keypad - * D0 (2) Y0 - * D1 (3) Y1 - * D2 (4) Y2 - * D3 (5) Y3 - * D4 (6) Y4 - * D5 (7) Y5 - * D6 (8) Y6 - * D7 (9) Y7 - * nSTRB (1) Y8 - * nSEL (17) Y9 - * nACK (10) X0 - * BUSY (11) X1 - * PAPEREND (12) X2 - * SELIN (13) X3 - * nFAULT (15) X4 + * D0 (2) Y1 + * D1 (3) Y2 + * D2 (4) Y3 + * D3 (5) Y4 + * D4 (6) Y5 + * D5 (7) Y6 + * D6 (8) Y7 + * D7 (9) Y8 + * nSTRB (1) Y9 + * nSEL (17) Y10 (optional, only if no backlight is used) + * nACK (10) X1 + * BUSY (11) X2 + * PAPEREND (12) X3 + * SELIN (13) X4 + * nFAULT (15) X5 * * Created modular driver Dec 1999, Benjamin Tse * @@ -179,7 +179,7 @@ void lcdtime_HD44780_backlight(PrivateData *p, unsigned char state) /** * Read keypress. * \param p Pointer to driver's private data structure. - * \param YData ??? + * \param YData Bitmap of rows / lines to enable. * \return Bitmap of the pressed keys. */ unsigned char lcdtime_HD44780_readkeypad(PrivateData *p, unsigned int YData) @@ -188,19 +188,19 @@ unsigned char lcdtime_HD44780_readkeypad(PrivateData *p, unsigned int YData) sem_wait(semid); - // 10 bits output or 8 bits if >=2 displays // Convert the positive logic to the negative logic on the LPT port port_out(p->port, ~YData & 0x00FF); - if (p->numDisplays<=2) { - // Can't combine >3 displays with >8 keypad output lines + // 9 bits output if backlight is used, 10 bits otherwise + if (p->have_backlight) + port_out(p->port + 2, (((~YData & 0x0100) >> 8) | p->backlight_bit) ^ OUTMASK); + else port_out(p->port + 2, (((~YData & 0x0100) >> 8) | ((~YData & 0x0200) >> 6)) ^ OUTMASK); - } if (p->delayBus) p->hd44780_functions->uPause(p, 1); // Read inputs readval = ~ port_in(p->port + 1) ^ INMASK; - // Put port back into idle state for backlight + // Put port back into idle state port_out(p->port, p->backlight_bit ^ OUTMASK); sem_signal(semid); diff --git a/server/drivers/hd44780-serialLpt.c b/server/drivers/hd44780-serialLpt.c index c921c31..aeaab6f 100644 --- a/server/drivers/hd44780-serialLpt.c +++ b/server/drivers/hd44780-serialLpt.c @@ -31,19 +31,19 @@ * Keypad connection (optional): * This is connected on the 4094 parallel to the LCD. * Some diodes and resistors are needed, see further documentation. - * Q1 (4) Y0 - * Q2 (5) Y1 - * Q3 (6) Y2 - * Q4 (7) Y3 - * Q5 (14) Y4 - * Q6 (13) Y5 - * Q7 (12) Y6 + * Q1 (4) Y1 + * Q2 (5) Y2 + * Q3 (6) Y3 + * Q4 (7) Y4 + * Q5 (14) Y5 + * Q6 (13) Y6 + * Q7 (12) Y7 * The 'output' of the keys should be connected to the following LPT pins: - * nACK (10) X0 - * BUSY (11) X1 - * PAPEREND (12) X2 - * SELIN (13) X3 - * nFAULT (15) X4 + * nACK (10) X1 + * BUSY (11) X2 + * PAPEREND (12) X3 + * SELIN (13) X4 + * nFAULT (15) X5 * If you want to use as few LPT lines as possible, only use X0. * * This file is released under the GNU General Public License. Refer to the diff --git a/server/drivers/hd44780-winamp.c b/server/drivers/hd44780-winamp.c index 0731335..c9570af 100644 --- a/server/drivers/hd44780-winamp.c +++ b/server/drivers/hd44780-winamp.c @@ -46,19 +46,19 @@ * Keypad connection (optional): * Some diodes and resistors are needed, see further documentation. * printer port keypad - * D0 (2) Y0 - * D1 (3) Y1 - * D2 (4) Y2 - * D3 (5) Y3 - * D4 (6) Y4 - * D5 (7) Y5 - * D6 (8) Y6 - * D7 (9) Y7 - * nACK (10) X0 - * BUSY (11) X1 - * PAPEREND (12) X2 - * SELIN (13) X3 - * nFAULT (15) X4 + * D0 (2) Y1 + * D1 (3) Y2 + * D2 (4) Y3 + * D3 (5) Y4 + * D4 (6) Y5 + * D5 (7) Y6 + * D6 (8) Y7 + * D7 (9) Y8 + * nACK (10) X1 + * BUSY (11) X2 + * PAPEREND (12) X3 + * SELIN (13) X4 + * nFAULT (15) X5 */ #include "hd44780-winamp.h"