From fa0f122b10c3fdd27ec1152e02bd15a510ceb6ba Mon Sep 17 00:00:00 2001 From: marschap Date: Sun, 31 Dec 2006 15:41:20 +0000 Subject: [PATCH] sed1330 update & extension (Benjamin Wiedmann) --- ChangeLog | 1 + LCDd.conf | 6 +- TODO | 2 + docs/lcdproc-user/drivers/sed1330.docbook | 171 +++++++++++++++++++++- server/drivers/sed1330.c | 98 +++++++++++-- server/drivers/sed1330.h | 30 ++-- 6 files changed, 276 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index b23215a..5dfdc38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +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) v.0.5.1 + config file support in lcdproc client (Andrew Foss) diff --git a/LCDd.conf b/LCDd.conf index 304dba6..e1c05f5 100644 --- a/LCDd.conf +++ b/LCDd.conf @@ -697,10 +697,12 @@ Device=/dev/ttyUSB0 # Port where the LPT is. Common values are 0x278, 0x378 and 0x3BC Port=0x378 -# Type of LCD module (legal: G321D, G121C, G242C, G191D, G2446) -# Note: G321D is the only one that is tested currently. +# Type of LCD module (legal: G321D, G121C, G242C, G191D, G2446, SP14Q002) +# Note: Currently only tested with G321D & SP14Q002. Type=G321D +# Width x Height of a character cell in pixels (legal: 6x7 - 8x16; default: 6x10) +CellSize=6x10 ## Seiko Epson 1520 driver ## diff --git a/TODO b/TODO index e1da6a4..b185253 100644 --- a/TODO +++ b/TODO @@ -11,6 +11,8 @@ Things for the short term: - 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 021efe3..8378891 100644 --- a/docs/lcdproc-user/drivers/sed1330.docbook +++ b/docs/lcdproc-user/drivers/sed1330.docbook @@ -2,10 +2,150 @@ The sed1330 Driver -This section talks about using LCDproc with LCD displays that use the -sed1330 chipset. +This section talks about using LCDproc with graphical LCD displays driven by +the EPSON/SMOS SED1330 or SED1335 LCD controllers, which may also be known by their +new names: S1D13300 (= SED1330) and S1D13305 (SED1335). + +The displays are driven in text mode using their built-in character generator. + +Connections + + +Connections below are for the G242C, G121C and G321D displays. +Always consult documentation about the specific display before asuming +the connections given here are also correct for your display ! + + + + Ordered by LCD pins + + pin LPT port + ^RESET 1 1 ^STROBE + ^RD 2 +5V + ^WR 3 16 ^INIT + SEL1 4 GND + SEL2 5 GND + ^CS 6 GND + A0 7 17 ^SELECT_IN + D0 8 2 D0 + D1 9 3 D1 + D2 10 4 D2 + D3 11 5 D3 + D4 12 6 D4 + D5 13 7 D5 + D6 14 8 D6 + D7 15 9 D7 + Vdd 16 +5V + Vss 17 GND 18..25 GND + V0 18 potmeter + Vlc 19 -24V + Frame 20 GND + 10 ^ACK + GND 11 BUSY + 12 PAPEREND + 13 ^SELECT + 14 ^LF + 15 ^ERROR +]]> + + + Or ordered by the LPT port pins: + + pin LPT port + ^RESET 1 1 ^STROBE + D0 8 2 D0 + D1 9 3 D1 + D2 10 4 D2 + D3 11 5 D3 + D4 12 6 D4 + D5 13 7 D5 + D6 14 8 D6 + D7 15 9 D7 + 10 ^ACK + GND 11 BUSY + 12 PAPEREND + 13 ^SELECT + 14 ^LF + 15 ^ERROR + ^WR 3 16 ^INIT + A0 7 17 ^SELECT_IN + Vss 17 GND 18..25 GND + ^RD 2 +5V + SEL1 4 GND + SEL2 5 GND + ^CS 6 GND + Vdd 16 +5V + V0 18 potmeter + Vlc 19 -24V (not required for G242C) + Frame 20 GND +]]> + + +The potmeter should be connected like this on these display modules: + + + + + +The G242C generates -24V internally. It is available on Vlc. + +To generate -24 from the +5V without an external power source, you can +use the following circuit. + + + + + + + + + + Configuration in LCDd.conf @@ -14,6 +154,24 @@ sed1330 chipset. [sed1330] + + + CellSize= + + WIDTH + x + HEIGHT + + + + Specify the size of a character in pixels. + WIDTH may vary between 6 and 8; + legal values for HEIGHT range from 7 to + 16. + If not given CellSize defaults to 6x10. + + + Port= @@ -37,6 +195,7 @@ sed1330 chipset. G242C G191D G2446 + SP14Q002 @@ -45,12 +204,18 @@ sed1330 chipset. Type of LCD module. - The G321D is the only one that is tested currently. + The G321D and SP14Q002 are the only ones that this driver is tested with currently. + +Contrary to other drivers the character size of an LCD is not given 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 0424fea..03c93e5 100644 --- a/server/drivers/sed1330.c +++ b/server/drivers/sed1330.c @@ -15,6 +15,7 @@ * * Copyright (c) 2001-2003, Joris Robijn * 2003, Michael Rohde + * 2006, Benjamin Wiedmann * * * Changelog: @@ -41,6 +42,13 @@ * - added function sed1330_icon to get correct display of full blocks * May 2003, Joris Robijn * - Made bars have spaces between them (I hope people like this) + * December 2006, Benjamin Wiedmann + * - added support for Hitachi SP14Q002 gLCD (320x240) with ccfl inverter + * - 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 * * * IMPORTANT: MODULES OTHER THAN G321D @@ -173,11 +181,12 @@ * * With the display= option you should specify what display module you have. * Accepted values are: - * display=G121C - * display=G242C - * display=G321D - * display=G191D - * display=G2446 + * type=G121C + * type=G242C + * type=G321D + * type=G191D + * type=G2446 + * type=SP14Q002 * The port= value should be set to the LPT port address that the LCD is * connected to. Examples: * port=0x378 @@ -210,9 +219,33 @@ #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 -#define nRESET STRB -#define nWR INIT +// pin 1 +#define nRESET STRB +// pin 16 +#define nWR INIT + +#endif // Command definitions #define CMD_SYSTEM_SET 0x40 @@ -237,11 +270,12 @@ #define KEYPAD_MAXX 5 #define KEYPAD_MAXY 8 -#define TYPE_G321D 1 -#define TYPE_G121C 2 -#define TYPE_G242C 3 -#define TYPE_G191D 4 -#define TYPE_G2446 5 +#define TYPE_G321D 1 +#define TYPE_G121C 2 +#define TYPE_G242C 3 +#define TYPE_G191D 4 +#define TYPE_G2446 5 +#define TYPE_SP14Q002 6 #define SCR1_L 0x00 // Memory locations #define SCR1_H 0x00 @@ -378,7 +412,10 @@ sed1330_init( Driver * drvthis ) p->type = TYPE_G2446; p->graph_width = 240; p->graph_height = 64; - + } else if(strcmp(s, "SP14Q002") == 0) { + p->type = TYPE_SP14Q002; + p->graph_width = 320; + p->graph_height = 240; } else { report(RPT_ERR, "%s: Unknown display type %s", drvthis->name, s); return -1; @@ -498,6 +535,9 @@ sed1330_init( Driver * drvthis ) case TYPE_G321D: data[4] = 0x38; break; + case TYPE_SP14Q002: + data[4] = 0x38; + break; case TYPE_G121C: data[4] = 0x7F; // ? please confirm these numbers break; @@ -635,6 +675,38 @@ sed1330_height( Driver * drvthis ) } +/** + * Return the width of a character in pixels. + * \param drvthis Pointer to driver structure. + * \return Number of pixel columns a character cell is wide. + */ +MODULE_EXPORT int +sed1330_cellwidth(Driver *drvthis) +{ +PrivateData *p = drvthis->private_data; + + debug(RPT_DEBUG, "%s: returning cellwidth", drvthis->name); + + return p->cellwidth; +} + + +/** + * Return the height of a character in pixels. + * \param drvthis Pointer to driver structure. + * \return Number of pixel lines a character cell is high. + */ +MODULE_EXPORT int +sed1330_cellheight(Driver *drvthis) +{ +PrivateData *p = drvthis->private_data; + + debug(RPT_DEBUG, "%s: returning cellheight", drvthis->name); + + return p->cellheight; +} + + ///////////////////////////////////////////////////////////////// // Clear the framebuffer // diff --git a/server/drivers/sed1330.h b/server/drivers/sed1330.h index 904ef11..6af4592 100644 --- a/server/drivers/sed1330.h +++ b/server/drivers/sed1330.h @@ -8,23 +8,25 @@ #include "lcd.h" -MODULE_EXPORT int sed1330_init( Driver * drvthis ); -MODULE_EXPORT void sed1330_close( Driver * drvthis ); -MODULE_EXPORT int sed1330_width( Driver * drvthis ); -MODULE_EXPORT int sed1330_height( Driver * drvthis ); -MODULE_EXPORT void sed1330_clear( Driver * drvthis ); -MODULE_EXPORT void sed1330_flush( Driver * drvthis ); -MODULE_EXPORT void sed1330_string( Driver * drvthis, int x, int y, char lcd[] ); -MODULE_EXPORT void sed1330_chr( Driver * drvthis, int x, int y, char c ); +MODULE_EXPORT int sed1330_init(Driver *drvthis); +MODULE_EXPORT void sed1330_close(Driver *drvthis); +MODULE_EXPORT int sed1330_width(Driver *drvthis); +MODULE_EXPORT int sed1330_height(Driver *drvthis); +MODULE_EXPORT int sed1330_cellheight(Driver *drvthis); +MODULE_EXPORT int sed1330_cellwidth(Driver *drvthis); +MODULE_EXPORT void sed1330_clear(Driver *drvthis); +MODULE_EXPORT void sed1330_flush(Driver *drvthis); +MODULE_EXPORT void sed1330_string(Driver *drvthis, int x, int y, char lcd[]); +MODULE_EXPORT void sed1330_chr(Driver *drvthis, int x, int y, char c); -MODULE_EXPORT void sed1330_vbar( Driver * drvthis, int x, int y, int len, int promille, int pattern ); -MODULE_EXPORT void sed1330_hbar( Driver * drvthis, int x, int y, int len, int promille, int pattern ); -MODULE_EXPORT void sed1330_num( Driver * drvthis, int x, int y, int num ); -MODULE_EXPORT void sed1330_heartbeat( Driver * drvthis, int type ); +MODULE_EXPORT void sed1330_vbar(Driver *drvthis, int x, int y, int len, int promille, int pattern); +MODULE_EXPORT void sed1330_hbar(Driver *drvthis, int x, int y, int len, int promille, int pattern); +MODULE_EXPORT void sed1330_num(Driver *drvthis, int x, int y, int num); +MODULE_EXPORT void sed1330_heartbeat(Driver *drvthis, int type); // No cursor function: use software cursor to prevent flickering ! */ -MODULE_EXPORT int sed1330_icon( Driver * drvthis, int x, int y, int icon); +MODULE_EXPORT int sed1330_icon(Driver *drvthis, int x, int y, int icon); -MODULE_EXPORT void sed1330_backlight( Driver * drvthis, int on ); +MODULE_EXPORT void sed1330_backlight(Driver *drvthis, int on); MODULE_EXPORT const char * sed1330_get_key(Driver *drvthis); #endif