From b821127fa7c07b154d2701bf7c0a2f85aec8f01f Mon Sep 17 00:00:00 2001 From: robijn Date: Thu, 1 Nov 2001 16:40:57 +0000 Subject: [PATCH] Minor bugfixes to HD44780 backlight and keypad stuff. --- server/drivers/hd44780-4bit.c | 2 +- server/drivers/hd44780-ext8bit.c | 2 +- server/drivers/hd44780-winamp.c | 13 +++++++------ server/drivers/hd44780.c | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/server/drivers/hd44780-4bit.c b/server/drivers/hd44780-4bit.c index e964e83..f458725 100644 --- a/server/drivers/hd44780-4bit.c +++ b/server/drivers/hd44780-4bit.c @@ -244,7 +244,7 @@ unsigned char lcdstat_HD44780_readkeypad (unsigned int YData) readval = ~ port_in (lptPort + 1) ^ INMASK; // Put port back into idle state for backlight - port_out (lptPort, backlight_bit ^ OUTMASK); + port_out (lptPort, backlight_bit); // And convert value back. return ( (readval >> 4 & 0x03) | (readval >> 5 & 0x04) | (readval >> 3 & 0x08) | (readval << 1 & 0x10) ) & ~stuckinputs; diff --git a/server/drivers/hd44780-ext8bit.c b/server/drivers/hd44780-ext8bit.c index 1967945..f427452 100644 --- a/server/drivers/hd44780-ext8bit.c +++ b/server/drivers/hd44780-ext8bit.c @@ -155,7 +155,7 @@ unsigned char lcdtime_HD44780_readkeypad (unsigned int YData) sem_wait (semid); - // 10 bits output + // 10 bits output or 8 bits if >=3 displays // Convert the positive logic to the negative logic on the LPT port port_out (lptPort, ~YData & 0x00FF ); if (!extIF) { diff --git a/server/drivers/hd44780-winamp.c b/server/drivers/hd44780-winamp.c index ee53074..061cf73 100644 --- a/server/drivers/hd44780-winamp.c +++ b/server/drivers/hd44780-winamp.c @@ -127,13 +127,15 @@ lcdwinamp_HD44780_senddata (unsigned char displayID, unsigned char flags, unsign else portControl = 0; + portControl |= backlight_bit; + if (displayID == 0) enableLines = EnMask[0] | EnMask[1] | ((extIF) ? EnMask[2] : 0); else enableLines = EnMask[displayID - 1]; // 40 nS setup time for RS valid to EN high, so set RS - port_out (lptPort + 2, (portControl|backlight_bit) ^ OUTMASK); + port_out (lptPort + 2, portControl ^ OUTMASK); // Output the actual data port_out (lptPort, ch); @@ -141,7 +143,7 @@ lcdwinamp_HD44780_senddata (unsigned char displayID, unsigned char flags, unsign if( delayBus ) hd44780_functions->uPause (1); // then set EN high - port_out (lptPort + 2, (enableLines|portControl|backlight_bit) ^ OUTMASK); + port_out (lptPort + 2, (enableLines|portControl) ^ OUTMASK); if( delayBus ) hd44780_functions->uPause (1); @@ -152,7 +154,7 @@ lcdwinamp_HD44780_senddata (unsigned char displayID, unsigned char flags, unsign // ABOVE TEXT ignored now, using delays if delayBus is specified // Set EN low and we're done... - port_out (lptPort + 2, (portControl|backlight_bit) ^ OUTMASK); + port_out (lptPort + 2, portControl ^ OUTMASK); // 10 nS data hold time provided by the length of ISA write for EN } @@ -168,10 +170,9 @@ unsigned char lcdwinamp_HD44780_readkeypad (unsigned int YData) { unsigned char readval; - // 10 bits output + // 8 bits output // Convert the positive logic to the negative logic on the LPT port port_out (lptPort, ~YData & 0x00FF ); - port_out (lptPort + 2, ( ((~YData & 0x0100) >> 7) | ((~YData & 0x0200) >> 7 )) ^ OUTMASK); if( delayBus ) hd44780_functions->uPause (1); @@ -179,7 +180,7 @@ unsigned char lcdwinamp_HD44780_readkeypad (unsigned int YData) readval = ~ port_in (lptPort + 1) ^ INMASK; // Set output back to idle state for backlight - port_out (lptPort + 2, backlight_bit ^ INMASK ); + port_out (lptPort + 2, backlight_bit ^ OUTMASK ); // And convert value back. return ( (readval >> 4 & 0x03) | (readval >> 5 & 0x04) | (readval >> 3 & 0x08) | (readval << 1 & 0x10) ) & ~stuckinputs; diff --git a/server/drivers/hd44780.c b/server/drivers/hd44780.c index a633a8e..747fb34 100644 --- a/server/drivers/hd44780.c +++ b/server/drivers/hd44780.c @@ -116,7 +116,7 @@ static int *dispSizes = NULL; char have_keypad = 0; // off by default char have_backlight = 0; // off by default char extIF = 0; // off by default -int delayMult = 1; // Delay multiplier for slow displays +int delayMult = 0; // Delay multiplier for slow displays char delayBus = 0; // Delay if the computer can send data too fast over // its bus to LPT port @@ -202,7 +202,7 @@ HD44780_init (lcd_logical_driver * driver, char *args) have_keypad = driver->config_get_bool( DriverName, "keypad", 0, 0 ); have_backlight = driver->config_get_bool( DriverName, "backlight", 0, 0 ); delayMult = driver->config_get_int( DriverName, "delaymult", 0, 1 ); - delayBus = driver->config_get_bool( DriverName, "delaybus", 0, 0 ); + delayBus = driver->config_get_bool( DriverName, "delaybus", 0, 1 ); // Get and search for the connection type s = driver->config_get_string( DriverName, "connectiontype", 0, "4bit" );