diff --git a/ChangeLog b/ChangeLog index fe043a0..5e90c7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,7 +24,7 @@ v.0.5dev (ongoing development) * make Brightness & OffBrightness run-time configurable in CFontz & MtxOrb * add support for Iface and ProcSize screens for OS X / Darwin (Eric Pooch) * update & fix serialVFD driver (Stefan Herdler) - + Hitachi SP14Q002 support & another connection type to sed1330 (Benjamin Wiedmann) + + Hitachi SP14Q002 support & ConnectionType setting for sed1330 (Benjamin Wiedmann) * replace obsolete index() by strchr() (Guillaume LECERF) v.0.5.1 diff --git a/LCDd.conf b/LCDd.conf index e1c05f5..9062b25 100644 --- a/LCDd.conf +++ b/LCDd.conf @@ -701,9 +701,12 @@ Port=0x378 # Note: Currently only tested with G321D & SP14Q002. Type=G321D -# Width x Height of a character cell in pixels (legal: 6x7 - 8x16; default: 6x10) +# Width x Height of a character cell in pixels [legal: 6x7 - 8x16; default: 6x10] CellSize=6x10 +# Select what type of connection [legal: classic, bitshaker; default: classic] +ConnectionType=classic + ## Seiko Epson 1520 driver ## [sed1520] diff --git a/TODO b/TODO index b185253..76bb452 100644 --- a/TODO +++ b/TODO @@ -6,13 +6,9 @@ Please send a message to the mailing list if you have any question. Things for the short term: - Use centralized command message parsing engine (more secure) -- allow bignum library to use user-defined characters different - from 0 - N but from M - (M+N) - more features for existing display drivers (e.g. adapt them to bignum library) - documentation (any help is appreciated) -- ConnectionType configuration parameter for the sed1330 driver to - distinguish between the default and bitshaker (a.k.a. yasedw) wiring Things for the longer term: diff --git a/docs/lcdproc-user/drivers/sed1330.docbook b/docs/lcdproc-user/drivers/sed1330.docbook index 8378891..48a89db 100644 --- a/docs/lcdproc-user/drivers/sed1330.docbook +++ b/docs/lcdproc-user/drivers/sed1330.docbook @@ -19,7 +19,7 @@ the connections given here are also correct for your display ! - Ordered by LCD pins +ConnectionType classic ordered by LCD pins pin LPT port @@ -52,7 +52,7 @@ the connections given here are also correct for your display ! ]]> - Or ordered by the LPT port pins: +ConnectionType classic ordered by LPT port pins pin LPT port @@ -172,6 +172,48 @@ use the following circuit. + + + ConnectionType= + + + classic + bitshaker + + + + + + Select the type of the wiring. + + + + + + + ConnectionType + Wiring + + + + + classic + ^WR = LPT pin 16, A0 = LPT pin 17, ^RESET = LPT pin 1 + + + bitshaker + ^WR = LPT pin 1, A0 = LPT pin 14, ^RESET = LPT pin 16 + + + + + + + If not given, it defaults to classic. + + + + Port= @@ -201,17 +243,57 @@ use the following circuit. - Type of LCD module. + Type of LCD module. Besised other things (internal setup) this configuration setting + detrmines the size of the display in pixels. + + + + + + Type + Size (in pixels) + + + + + G321D + 320 x 200 + + + G121C + 128 x 128 + + + G242C + 240 x 128 + + + G191D + 192 x 192 + + + G2446 + 240 x 64 + + + SP14Q002 + 320 x 240 + + + + + - The G321D and SP14Q002 are the only ones that this driver is tested with currently. + Currently the G321D and SP14Q002 are the only ones that this driver is tested with. -Contrary to other drivers the character size of an LCD is not given given directly. +Contrary to other drivers the character size of an LCD using the sed1330i +driver is not given directly. Instead it is determined by the pixel size of the display, which is derived from the display type setting and the character cell size. diff --git a/server/drivers/sed1330.c b/server/drivers/sed1330.c index 03c93e5..236a05c 100644 --- a/server/drivers/sed1330.c +++ b/server/drivers/sed1330.c @@ -47,9 +47,14 @@ * - built for parport version of this interface: Wallbraun Electronics lcdinterface * (specifications here: http://wallbraun-electronics.de/produkte/lcdinterface/index.html) * - wiring scheme used: "bitshaker" (called "yasedw" in serdisplib) - * --> default wiring: wr=16; a0=17; rd=01; cs=14 - * --> yasedw wiring: wr=01; a0=14; rd=16; cs=17 - * + * --> classic wiring: wr=16; a0=17; rd=01; cs=14 + * --> bitshaker wiring: wr=01; a0=14; rd=16; cs=17 + * December 2006, Benjamin Wiedmann (additional changes, fixup) + * - wiring scheme can now be changed at run time using "ConnectionType" config parameter + * in sed1330 driver section + * Usage of ConnectionType in LCDd.conf: + * ConnectionType= + * - if no ConnectionType is set it defaults to "classic" wiring * * IMPORTANT: MODULES OTHER THAN G321D * =================================== @@ -187,6 +192,11 @@ * type=G191D * type=G2446 * type=SP14Q002 + * + * You can also change the wiring scheme by using the ConnectionType= option: + * ConnectionType= + * If not set, classic wiring is used. + * * The port= value should be set to the LPT port address that the LCD is * connected to. Examples: * port=0x378 @@ -218,35 +228,6 @@ #define KEYPAD_AUTOREPEAT_DELAY 500 #define KEYPAD_AUTOREPEAT_FREQ 15 -// LPT lines - -// should we use the bitshaker wiring? -//#define WIRING_BITSHAKER - -#ifdef WIRING_BITSHAKER - -// use BITSHAKER / YASEDW wiring - -// pin 14 -#define A0 nLF -// pin 16 -#define nRESET INIT -// pin 1 -#define nWR STRB - -#else - -// use default wiring - -// pin 17 -#define A0 SEL -// pin 1 -#define nRESET STRB -// pin 16 -#define nWR INIT - -#endif - // Command definitions #define CMD_SYSTEM_SET 0x40 #define CMD_SLEEP_IN 0x53 @@ -283,12 +264,23 @@ #define SCR2_H 0x06 typedef struct p { + + // display type int type; + + // wiring scheme variables to be set by sed1330_init() + int A0; + int nRESET; + int nWR; + + // which lpt port to use int port; + unsigned char * framebuf_text; unsigned char * lcd_contents_text; unsigned char * framebuf_graph; unsigned char * lcd_contents_graph; + int width, height; int cellwidth, cellheight; int graph_width, graph_height; @@ -309,7 +301,6 @@ typedef struct p { struct timeval pressed_key_time; int stuckinputs; - } PrivateData; static char *defaultKeyMapDirect[KEYPAD_MAXX] = { "Enter", "Up", "Down", "Escape", "F1" }; @@ -422,6 +413,33 @@ sed1330_init( Driver * drvthis ) } report(RPT_INFO, "%s: Using LCD type %s", drvthis->name, s); + // Set wiring scheme to be used + // + // Valid ConnectionTypes: + // - classic (default) + // - bitshaker + // + // Get ConnectionType, if no type is set, default to "classic" wiring so it even + // works with config files missing that ConnectionType entry in sed1330 driver section + s = drvthis->config_get_string(drvthis->name, "ConnectionType", 0, "classic"); + + // Set wiring initialization parameters based on ConnectionType + if (strcmp(s, "classic") == 0) { + // Use classic wiring + p->A0 = SEL; // port 17 + p->nRESET = STRB; // port 1 + p->nWR = INIT; // port 16 + } else if(strcmp(s, "bitshaker") == 0) { + // Use bitshaker wiring + p->A0 = nLF; // port 14 + p->nRESET = INIT; // port 16 + p->nWR = STRB; // port 1 + } else { + report(RPT_ERR, "%s: Unknown ConnectionType %s", drvthis->name, s); + return -1; + } + report(RPT_INFO, "%s: Using ConnectionType %s", drvthis->name, s); + // Keypad ? p->have_keypad = drvthis->config_get_bool(drvthis->name, "keypad", 0, 0); @@ -523,12 +541,12 @@ sed1330_init( Driver * drvthis ) // INITIALIZE THE LCD // End reset-state debug(RPT_DEBUG, "%s: initializing LCD", __FUNCTION__); - port_out(p->port+2, (nWR) ^ OUTMASK); // raise ^RD and ^WR - port_out(p->port+2, (nRESET|nWR) ^ OUTMASK); // lower RESET + port_out(p->port+2, (p->nWR) ^ OUTMASK); // raise ^RD and ^WR + port_out(p->port+2, (p->nRESET|p->nWR) ^ OUTMASK); // lower RESET uPause(200); - port_out(p->port+2, (nWR) ^ OUTMASK); // raise RESET + port_out(p->port+2, (p->nWR) ^ OUTMASK); // raise RESET uPause(200); - port_out(p->port+2, (nRESET|nWR) ^ OUTMASK); // lower RESET + port_out(p->port+2, (p->nRESET|p->nWR) ^ OUTMASK); // lower RESET uPause(4000); switch (p->type) { @@ -596,16 +614,16 @@ sed1330_command( PrivateData * p, char command, int datacount, unsigned char * d int i; int port = p->port; - port_out(port+2, (nRESET|nWR|A0) ^ OUTMASK); // set A0 to indicate command + port_out(port+2, (p->nRESET|p->nWR|p->A0) ^ OUTMASK); // set A0 to indicate command port_out(port, command); // set up p - port_out(port+2, (nRESET|A0) ^ OUTMASK); // activate ^WR - port_out(port+2, (nRESET|nWR|A0) ^ OUTMASK); // deactivate ^WR again - port_out(port+2, (nRESET|nWR) ^ OUTMASK); // clear A0 to indicate p + port_out(port+2, (p->nRESET|p->A0) ^ OUTMASK); // activate ^WR + port_out(port+2, (p->nRESET|p->nWR|p->A0) ^ OUTMASK); // deactivate ^WR again + port_out(port+2, (p->nRESET|p->nWR) ^ OUTMASK); // clear A0 to indicate p for (i = 0; i < datacount; i++) { port_out(port, data[i]); // set up data - port_out(port+2, (nRESET) ^ OUTMASK); // activate ^WR - port_out(port+2, (nRESET|nWR) ^ OUTMASK); // deactivate ^WR again + port_out(port+2, (p->nRESET) ^ OUTMASK); // activate ^WR + port_out(port+2, (p->nRESET|p->nWR) ^ OUTMASK); // deactivate ^WR again } }