diff --git a/ChangeLog b/ChangeLog index d133626..fdfc466 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ v0.5dev (ongoing development) * picolcd: Use libusb-1.0 asynchronous transfers to fix missed keys (M. Jones) * sed1520: Make it work without using an external inverter * lis driver: Make the last pixel row work (add lastline option parsing) + * hd44780/ftdi: Fix error in setting backlight and add backlight for 4bit mode v0.5.5 + sed1330 driver: Add support for HG25504 (L. Lagendijk) diff --git a/docs/lcdproc-user/drivers/hd44780.docbook b/docs/lcdproc-user/drivers/hd44780.docbook index ac8fbc1..b89e67f 100644 --- a/docs/lcdproc-user/drivers/hd44780.docbook +++ b/docs/lcdproc-user/drivers/hd44780.docbook @@ -1872,6 +1872,39 @@ The wiring of the control lines can optionally be reconfigured, please look at the driver source if you really need that. + +The backlight line is driven high when the backlight is on. +Therefore the standard backlight circuit () +will not work. Use the following instead. + + +
+hd44780/ftdi: Backlight Wiring + + + +
+ + Alternatively you can use a single channel FTDI FT245BM USB <-> parallel FIFO chip and use the display in its 4 bit mode. @@ -1948,6 +1981,13 @@ FIFO chip and use the display in its 4 bit mode. RW 5 + + D7 + 18 + + BL + Backlight (optional) + @@ -1967,6 +2007,7 @@ ftdi_mode=4 ftdi_line_EN=0x10 ftdi_line_RS=0x20 ftdi_line_RW=0x40 +ftdi_line_backlight=0x80 ]]> diff --git a/server/drivers/hd44780-ftdi.c b/server/drivers/hd44780-ftdi.c index c413fd6..bcb89e3 100644 --- a/server/drivers/hd44780-ftdi.c +++ b/server/drivers/hd44780-ftdi.c @@ -6,12 +6,13 @@ wiring example: FTDI chip: D0 D1 D2 D3 D4 D5 D6 D7 | | | | | | | | - HD44780: D4 D5 D6 D7 EN RS RW n/c + HD44780: D4 D5 D6 D7 EN RS RW BL in LCDd.conf we then need to define ftdi_line_EN=0x10 ftdi_line_RS=0x20 ftdi_line_RW=0x40 + ftdi_line_backlight=0x80 RW of your display can either be connected to D6 or GND. \endverbatim @@ -197,8 +198,9 @@ ftdi_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char fla unsigned char buf[4]; unsigned char portControl = 0; + portControl = 0x00 | p->backlight_bit; if (flags == RS_DATA) { - portControl = p->ftdi_line_RS; + portControl |= p->ftdi_line_RS; } buf[0] = ((ch >> 4) & 0x0F) | portControl | p->ftdi_line_EN; @@ -228,18 +230,28 @@ ftdi_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char fla void ftdi_HD44780_backlight(PrivateData *p, unsigned char state) { + unsigned char buf[1]; + int f; + + p->backlight_bit = state ? p->ftdi_line_backlight : 0; + buf[0] = p->backlight_bit; + if (p->ftdi_mode == 8) { - int f; - - p->backlight_bit = state ? p->ftdi_line_backlight : 0; - - f = ftdi_write_data(&p->ftdic2, &state, 1); + f = ftdi_write_data(&p->ftdic2, buf, 1); if (f < 0) { p->hd44780_functions->drv_report(RPT_ERR, "failed to write: %d (%s). Exiting", f, ftdi_get_error_string(&p->ftdic2)); exit(-1); } } + else { + f = ftdi_write_data(&p->ftdic, buf, 1); + if (f < 0) { + p->hd44780_functions->drv_report(RPT_ERR, "failed to write: %d (%s). Exiting", + f, ftdi_get_error_string(&p->ftdic)); + exit(-1); + } + } }