Minor bugfixes to HD44780 backlight and keypad stuff.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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" );
|
||||
|
||||
Reference in New Issue
Block a user