From 5543902aef837179a8d9c23e7c8de624de0be93d Mon Sep 17 00:00:00 2001 From: harbaum Date: Mon, 30 Jan 2006 20:21:51 +0000 Subject: [lcd4linux @ 2006-01-30 20:21:51 by harbaum] LCD2USB: Added support for displays with two controllers git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@632 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- drv_LCD2USB.c | 59 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/drv_LCD2USB.c b/drv_LCD2USB.c index dc7f380..5dd8de4 100644 --- a/drv_LCD2USB.c +++ b/drv_LCD2USB.c @@ -1,4 +1,4 @@ -/* $Id: drv_LCD2USB.c,v 1.3 2006/01/30 06:25:52 reinelt Exp $ +/* $Id: drv_LCD2USB.c,v 1.4 2006/01/30 20:21:51 harbaum Exp $ * * driver for USB2LCD display interface * see http://www.harbaum.org/till/lcd2usb for schematics @@ -24,6 +24,9 @@ * * * $Log: drv_LCD2USB.c,v $ + * Revision 1.4 2006/01/30 20:21:51 harbaum + * LCD2USB: Added support for displays with two controllers + * * Revision 1.3 2006/01/30 06:25:52 reinelt * added CVS Revision * @@ -52,6 +55,7 @@ #include #include #include +#include #include #include @@ -79,9 +83,9 @@ #define LCD_GET (4<<5) /* target is a bit map for CMD/DATA */ -#define LCD_ENABLE0 (1<<3) -#define LCD_ENABLE1 (1<<4) -#define LCD_BOTH (LCD_ENABLE0 | LCD_ENABLE1) +#define LCD_CTRL_0 (1<<3) +#define LCD_CTRL_1 (1<<4) +#define LCD_BOTH (LCD_CTRL_0 | LCD_CTRL_1) /* target is value to set */ #define LCD_SET_CONTRAST (LCD_SET | (0<<3)) @@ -195,7 +199,7 @@ static void drv_L2U_flush(void) return; /* build request byte */ - request = buffer_current_type | LCD_ENABLE0 | (buffer_current_fill - 1); + request = buffer_current_type | (buffer_current_fill - 1); /* fill value and index with buffer contents. endianess should IMHO not */ /* be a problem, since usb_control_msg() will handle this. */ @@ -225,24 +229,29 @@ static void drv_L2U_enqueue(int command_type, int value) drv_L2U_flush(); } -static void drv_L2U_command(const unsigned char cmd) +static void drv_L2U_command(const unsigned char ctrl, const unsigned char cmd) { - drv_L2U_enqueue(LCD_CMD, cmd); + drv_L2U_enqueue(LCD_CMD | ctrl, cmd); } static void drv_L2U_clear(void) { - drv_L2U_command(0x01); /* clear display */ - drv_L2U_command(0x03); /* return home */ + drv_L2U_command(LCD_BOTH, 0x01); /* clear display */ + drv_L2U_command(LCD_BOTH, 0x03); /* return home */ } - -static void drv_L2U_write(const int row, const int col, const char *data, int len) +static void drv_L2U_write(int row, const int col, const char *data, int len) { - int pos; - -// printf("write %d/%d %s(%d)\n", row, col, data, len); + int pos, ctrl = LCD_CTRL_0; + + /* displays with more two rows and 20 columns have a logical width */ + /* of 40 chars and use more than one controller */ + if ((DROWS > 2) && (DCOLS > 20) && (row > 1)) { + /* use second controller */ + row -= 2; + ctrl = LCD_CTRL_1; + } /* 16x4 Displays use a slightly different layout */ if (DCOLS == 16 && DROWS == 4) { @@ -251,10 +260,10 @@ static void drv_L2U_write(const int row, const int col, const char *data, int le pos = (row % 2) * 64 + (row / 2) * 20 + col; } - drv_L2U_command(0x80 | pos); + drv_L2U_command(ctrl, 0x80 | pos); while (len--) { - drv_L2U_enqueue(LCD_DATA, *data++); + drv_L2U_enqueue(LCD_DATA | ctrl, *data++); } drv_L2U_flush(); @@ -264,10 +273,10 @@ static void drv_L2U_defchar(const int ascii, const unsigned char *matrix) { int i; - drv_L2U_command(0x40 | 8 * ascii); + drv_L2U_command(LCD_BOTH, 0x40 | 8 * ascii); for (i = 0; i < 8; i++) { - drv_L2U_enqueue(LCD_DATA, *matrix++ & 0x1f); + drv_L2U_enqueue(LCD_DATA | LCD_BOTH, *matrix++ & 0x1f); } drv_L2U_flush(); @@ -322,13 +331,13 @@ static int drv_L2U_start(const char *section, const int quiet) error("%s: could not find a LCD2USB USB LCD", Name); return -1; } - +#if 0 // already done by driver /* initialize display */ - drv_L2U_command(0x29); /* 8 Bit mode, 1/16 duty cycle, 5x8 font */ - drv_L2U_command(0x08); /* Display off, cursor off, blink off */ - drv_L2U_command(0x0c); /* Display on, cursor off, blink off */ - drv_L2U_command(0x06); /* curser moves to right, no shift */ - + drv_L2U_command(LCD_BOTH, 0x29); /* 8 Bit mode, 1/16 duty cycle, 5x8 fnt */ + drv_L2U_command(LCD_BOTH, 0x08); /* Display off, cursor off, blink off */ + drv_L2U_command(LCD_BOTH, 0x0c); /* Display on, cursor off, blink off */ + drv_L2U_command(LCD_BOTH, 0x06); /* curser moves to right, no shift */ +#endif if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) { drv_L2U_contrast(contrast); @@ -405,7 +414,7 @@ int drv_L2U_init(const char *section, const int quiet) int asc255bug; int ret; - info("%s: %s", Name, "$Revision: 1.3 $"); + info("%s: %s", Name, "$Revision: 1.4 $"); /* display preferences */ XRES = 5; /* pixel width of one char */ -- cgit v1.2.3 evaluation ported from volker_dev (r820,r822,r824)michael1-8/+52 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@917 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-31Fixes a buffer underrun error and possible array index issues by mcarey@...michael1-6/+13 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@916 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-27ported r819 from volker_devmichael1-17/+21 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@915 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-27ported and modified r818 from volker_devmichael3-11/+151 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@914 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-27port r817 from volker_devmichael3-24/+944 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@913 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-27ported (modified) r815 from voker_devmichael1-3/+23 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@912 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-24cleanup & cosmeticsmichael5-22/+31 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@911 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-24driver for the PHAnderson serial-to-HD44780 adapter boards by Nicolas Weillmichael5-5/+444 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@910 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-24w1retap plugin by Jonathan Hudsonmichael7-0/+298 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@909 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-24Enables/controls the backlight on the Pertelian LCD device by Jonathan Hudsonmichael1-10/+13 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@908 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-23hddtemp plugin from Scott Bronsonmichael7-0/+343 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@907 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-23keypad bug fixedmichael1-1/+1 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@906 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-23patch from a.nielsen: inverted parport signals, support GPI on HD44780michael2-24/+89 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@905 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-12-23indent runmichael1-4/+4 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@904 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-11-25fix lcd4linux driver for multible onboard controllersmichux1-4/+4 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@903 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-11-23fix automake - check for libftdimichux4-9/+173 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@902 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-11-22update button_exec plugin - fix segfaultmichux1-3/+2 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@901 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-11-22update fifo plugin - untestedmichux1-1/+1 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@900 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-10-07Replace write to external variable usb_debug by calling usb_set_debug().bwalle7-16/+7 This fixes build on openSUSE Factory. git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@899 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-10-06adding GPI to picoLCD for reading button events by Igor Mammedov ↵michael1-1/+22 <niallain@gmail.com> git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@898 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-10-06properties fixedmichael11-3290/+2675 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@897 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-10-05Rebuild auto-generated autoconf stuff due to last change in drivers.m4.bwalle3-2657/+3297 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@896 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-10-05Add 'ULA200' driver when --with-drivers=all is specifiedbwalle1-0/+1 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@895 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-09-14strftime_tz patch from Bernhard Wallemichael1-0/+11 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@894 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-09-08strftime_tz() plugin by Bernhard Wallemichael1-0/+25 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@893 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-09-03ULA200 driver by Bernhard Wallemichael7-2/+825 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@892 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-09-03indentmichael1-4/+4 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@891 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-08-31Increased the maximum bps to 230400, if defined in <termios.h>.sonic741-2/+7 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@890 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-08-27git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@889 ↵sonic741-18/+11 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-08-27D4D updates by Svenmichael1-38/+60 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@888 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-08-03driver for 4D Systems serial displays by Sven Killigmichael9-45/+846 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@887 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-08-03signed/unsigned mismatchmichael1-3/+3 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@886 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-07-26added command functionsmichux1-2/+130 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@885 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-07-15added IRLCD driver by Jean-Philippe Civademichael10-5/+467 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@884 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2008-07-15'autoreconf -f -i' run & config.rpath addedmichael8-370/+1617 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@883 3ae390bd-cb1e-0410-b409-cd5a39f66f1f