aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drv_HD44780.c52
-rw-r--r--lcd4linux.conf.sample14
2 files changed, 55 insertions, 11 deletions
diff --git a/drv_HD44780.c b/drv_HD44780.c
index 63a1cc7..f69816e 100644
--- a/drv_HD44780.c
+++ b/drv_HD44780.c
@@ -1,4 +1,4 @@
-/* $Id: drv_HD44780.c,v 1.60 2006/01/05 18:56:57 reinelt Exp $
+/* $Id: drv_HD44780.c,v 1.61 2006/01/05 19:27:26 reinelt Exp $
*
* new style driver for HD44780-based displays
*
@@ -32,6 +32,9 @@
*
*
* $Log: drv_HD44780.c,v $
+ * Revision 1.61 2006/01/05 19:27:26 reinelt
+ * HD44780 power supply from parport
+ *
* Revision 1.60 2006/01/05 18:56:57 reinelt
* more GPO stuff
*
@@ -313,8 +316,9 @@ static int Capabilities;
/* Timings */
static int T_CY, T_PW, T_AS, T_AH;
-static int T_INIT1, T_INIT2, T_EXEC, T_WRCG, T_CLEAR, T_HOME, T_ONOFF;
-
+static int T_POWER, T_INIT1, T_INIT2, T_EXEC, T_WRCG, T_CLEAR, T_HOME, T_ONOFF;
+static int T_GPO_ST, T_GPO_PW;
+static int T_POWER;
static int Bits = 0;
static int numControllers = 0;
@@ -333,6 +337,7 @@ static unsigned char SIGNAL_ENABLE3;
static unsigned char SIGNAL_ENABLE4;
static unsigned char SIGNAL_BACKLIGHT;
static unsigned char SIGNAL_GPO;
+static unsigned char SIGNAL_POWER;
/* maximum time to wait for the busy-flag (in usec) */
#define MAX_BUSYFLAG_WAIT 10000
@@ -718,6 +723,8 @@ static int drv_HD_PP_load(const char *section)
return -1;
if ((SIGNAL_GPO = drv_generic_parport_hardwire_ctrl("GPO", "GND")) == 0xff)
return -1;
+ if ((SIGNAL_POWER = drv_generic_parport_hardwire_ctrl("POWER", "GND")) == 0xff)
+ return -1;
} else {
if (Bits == 8) {
if ((SIGNAL_RS = drv_generic_parport_wire_ctrl("RS", "AUTOFD")) == 0xff)
@@ -746,11 +753,13 @@ static int drv_HD_PP_load(const char *section)
if ((SIGNAL_ENABLE4 = drv_generic_parport_wire_data("ENABLE4", "GND")) == 0xff)
return -1;
}
- /* backlight and GPO are always control signals */
+ /* backlight GPO and power are always control signals */
if ((SIGNAL_BACKLIGHT = drv_generic_parport_wire_ctrl("BACKLIGHT", "GND")) == 0xff)
return -1;
if ((SIGNAL_GPO = drv_generic_parport_wire_ctrl("GPO", "GND")) == 0xff)
return -1;
+ if ((SIGNAL_POWER = drv_generic_parport_wire_ctrl("POWER", "GND")) == 0xff)
+ return -1;
}
/* clear capabilities if corresponding signal is GND */
@@ -773,6 +782,15 @@ static int drv_HD_PP_load(const char *section)
T_AS = timing(Name, section, "AS", 140, "ns"); /* Address setup time */
T_AH = timing(Name, section, "AH", 20, "ns"); /* Address hold time */
+ /* GPO timing */
+ if (SIGNAL_GPO != 0) {
+ T_GPO_ST = timing(Name, section, "GPO_ST", 20, "ns"); /* 74HCT573 set-up time */
+ T_GPO_PW = timing(Name, section, "GPO_PW", 230, "ns"); /* 74HCT573 enable pulse width */
+ } else {
+ T_GPO_ST = 0;
+ T_GPO_PW = 0;
+ }
+
/* HD44780 execution timings [microseconds]
* as these values differ from spec to spec,
* we use the worst-case default values, but allow
@@ -785,18 +803,33 @@ static int drv_HD_PP_load(const char *section)
T_CLEAR = timing(Name, section, "CLEAR", 2250, "us"); /* Clear Display */
T_HOME = timing(Name, section, "HOME", 2250, "us"); /* Return Cursor Home */
T_ONOFF = timing(Name, section, "ONOFF", 2250, "us"); /* Display On/Off Control */
+
+ /* Power-on delay */
+ if (SIGNAL_POWER != 0) {
+ T_POWER = timing(Name, section, "POWER", 500, "ms");
+ } else {
+ T_POWER = 0;
+ }
/* clear all signals */
if (Bits == 8) {
- drv_generic_parport_control(SIGNAL_RS |
- SIGNAL_RW | SIGNAL_ENABLE | SIGNAL_ENABLE2 | SIGNAL_ENABLE3 | SIGNAL_ENABLE4 | SIGNAL_BACKLIGHT | SIGNAL_GPO, 0);
+ drv_generic_parport_control(SIGNAL_RS | SIGNAL_RW |
+ SIGNAL_ENABLE | SIGNAL_ENABLE2 | SIGNAL_ENABLE3 | SIGNAL_ENABLE4 |
+ SIGNAL_BACKLIGHT | SIGNAL_GPO | SIGNAL_POWER, 0);
} else {
+ drv_generic_parport_control(SIGNAL_BACKLIGHT | SIGNAL_GPO | SIGNAL_POWER, 0);
drv_generic_parport_data(0);
}
/* set direction: write */
drv_generic_parport_direction(0);
+ /* raise power pin */
+ if (SIGNAL_POWER != 0) {
+ drv_generic_parport_control(SIGNAL_POWER, SIGNAL_POWER);
+ udelay (1000*T_POWER);
+ }
+
/* initialize *all* controllers */
if (Bits == 8) {
drv_HD_PP_command(allControllers, 0x30, T_INIT1); /* 8 Bit mode, wait 4.1 ms */
@@ -851,6 +884,7 @@ static void drv_HD_PP_stop(void)
SIGNAL_RW | SIGNAL_ENABLE | SIGNAL_ENABLE2 | SIGNAL_ENABLE3 | SIGNAL_ENABLE4 | SIGNAL_BACKLIGHT | SIGNAL_GPO, 0);
} else {
drv_generic_parport_data(0);
+ drv_generic_parport_control(SIGNAL_BACKLIGHT | SIGNAL_GPO | SIGNAL_POWER, 0);
}
drv_generic_parport_close();
@@ -1141,11 +1175,11 @@ static int drv_HD_GPO(const int num, const int val)
drv_generic_parport_data(GPO);
/* 74HCT573 set-up time */
- ndelay(20);
+ ndelay(T_GPO_ST);
/* send data */
- /* 74HCT573 enable pulse width = 24ns */
- drv_generic_parport_toggle(SIGNAL_GPO, 1, 230);
+ /* 74HCT573 enable pulse width */
+ drv_generic_parport_toggle(SIGNAL_GPO, 1, T_GPO_PW);
return v;
}
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index 5d33622..355830b 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -118,6 +118,7 @@ Display HD44780-generic {
ENABLE 'STROBE'
ENABLE2 'GND'
GPO 'INIT'
+ POWER 'GND'
}
}
@@ -135,6 +136,7 @@ Display HD44780-winamp {
ENABLE 'STROBE'
ENABLE2 'GND'
GPO 'GND'
+ POWER 'GND'
}
Timing {
# low-level communication [ns]
@@ -150,6 +152,11 @@ Display HD44780-winamp {
CLEAR 2250 # Clear Display
HOME 2250 # Return Cursor Home
ONOFF 2250 # Display On/Off Control
+ # GPO timing [ns]
+ GPO_ST 20 # 74HCT573 set-up time
+ GPO_PW 230 # 74HCT573 enable pulse width
+ # Power supply timing [ms]
+ POWER 500 # power-on delay
}
}
@@ -167,6 +174,7 @@ Display WDC2704M {
ENABLE 'STROBE'
ENABLE2 'SLCTIN'
GPO 'GND'
+ POWER 'GND'
}
}
@@ -183,6 +191,7 @@ Display HD44780-kernelconcepts {
ENABLE 'STROBE'
ENABLE2 'GND'
GPO 'GND'
+ POWER 'GND'
}
}
@@ -198,6 +207,7 @@ Display SC1602D {
RS 'AUTOFD'
ENABLE 'STROBE'
GPO 'INIT'
+ POWER 'GND'
}
}
@@ -908,12 +918,12 @@ Layout testMySQL {
#Display 'SerDispLib'
#Display 'LCD-Linux'
#Display 'LCD2041'
-Display 'LK202'
+#Display 'LK202'
#Display 'LK204'
#Display 'MI240'
#Display 'CW12232'
#Display 'HD44780-generic'
-#Display 'HD44780-WinAmp'
+Display 'HD44780-WinAmp'
#Display 'WDC2704M'
#Display 'SC1602D'
#Display 'LCM-162'