aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-09-21 06:43:02 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-09-21 06:43:02 +0000
commit6ad29537e9b46548040a6fa222e19abe9b5d4447 (patch)
treed4550f35553196940961255c2dacca72974e7e21
parenta47170396bc75a5e1f0414cd878b82249e07386d (diff)
downloadlcd4linux-6ad29537e9b46548040a6fa222e19abe9b5d4447.tar.gz
[lcd4linux @ 2003-09-21 06:43:02 by reinelt]
MatrixOrbital: bidirectional communication HD44780: special handling for 16x1 displays (thanks to anonymous bug report on sf.net) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@247 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--HD44780.c21
-rw-r--r--MatrixOrbital.c52
2 files changed, 71 insertions, 2 deletions
diff --git a/HD44780.c b/HD44780.c
index d26ebde..df8dce9 100644
--- a/HD44780.c
+++ b/HD44780.c
@@ -1,4 +1,4 @@
-/* $Id: HD44780.c,v 1.41 2003/09/13 06:20:39 reinelt Exp $
+/* $Id: HD44780.c,v 1.42 2003/09/21 06:43:02 reinelt Exp $
*
* driver for display modules based on the HD44780 chip
*
@@ -27,6 +27,12 @@
*
*
* $Log: HD44780.c,v $
+ * Revision 1.42 2003/09/21 06:43:02 reinelt
+ *
+ *
+ * MatrixOrbital: bidirectional communication
+ * HD44780: special handling for 16x1 displays (thanks to anonymous bug report on sf.net)
+ *
* Revision 1.41 2003/09/13 06:20:39 reinelt
* HD44780 timings changed; deactivated libtool
*
@@ -342,6 +348,9 @@ static void HD_write (unsigned char controller, char *string, int len, int delay
{
unsigned char enable;
+ // sanity check
+ if (len<=0) return;
+
if (Bits==8) {
// enable signal: 'controller' is a bitmask
@@ -549,6 +558,12 @@ void HD_goto (int row, int col)
Controller = 1;
}
+ // 16x1 Displays are organized as 8x2 :-(
+ if (Lcd.rows==1 && Lcd.cols==16 && col>7) {
+ row++;
+ col-=8;
+ }
+
pos=(row%2)*64+(row/2)*20+col;
HD_command (Controller, (0x80|pos), T_EXEC);
}
@@ -619,6 +634,10 @@ int HD_flush (void)
pos2=col;
equal=0;
}
+ // special handling of 16x1 displays
+ if (Lcd.rows==1 && Lcd.cols==16 && col==7) {
+ break;
+ }
}
HD_write (Controller, FrameBuffer1+row*Lcd.cols+pos1, pos2-pos1+1, T_EXEC);
}
diff --git a/MatrixOrbital.c b/MatrixOrbital.c
index 1ce3b2b..b25bc37 100644
--- a/MatrixOrbital.c
+++ b/MatrixOrbital.c
@@ -1,4 +1,4 @@
-/* $Id: MatrixOrbital.c,v 1.41 2003/09/13 06:45:43 reinelt Exp $
+/* $Id: MatrixOrbital.c,v 1.42 2003/09/21 06:43:02 reinelt Exp $
*
* driver for Matrix Orbital serial display modules
*
@@ -20,6 +20,12 @@
*
*
* $Log: MatrixOrbital.c,v $
+ * Revision 1.42 2003/09/21 06:43:02 reinelt
+ *
+ *
+ * MatrixOrbital: bidirectional communication
+ * HD44780: special handling for 16x1 displays (thanks to anonymous bug report on sf.net)
+ *
* Revision 1.41 2003/09/13 06:45:43 reinelt
* icons for all remaining drivers
*
@@ -252,6 +258,28 @@ static int MO_open (void)
}
+#if 1
+static int MO_read (char *string, int len)
+{
+ int ret;
+
+ if (Device==-1) return -1;
+ ret=read (Device, string, len);
+ if (ret<0 && errno==EAGAIN) {
+ debug ("read(): EAGAIN");
+ usleep(10000);
+ ret=read (Device, string, len);
+ }
+
+ if (ret<0) {
+ error("Cwlinux: read() failed: %s", strerror(errno));
+ }
+
+ return ret;
+}
+#endif
+
+
static void MO_write (char *string, int len)
{
if (Device==-1) return;
@@ -331,6 +359,9 @@ int MO_clear2 (int full)
static int MO_init (LCD *Self, int protocol)
{
+ // Fixme
+ char buffer[256];
+
char *port;
int speed;
@@ -401,6 +432,25 @@ static int MO_init (LCD *Self, int protocol)
MO_write ("\376D", 2); // line wrapping off
MO_write ("\376R", 2); // auto scroll off
+ #if 1
+ MO_write ("\3767", 2); // read module type
+ usleep(100000);
+ MO_read (buffer, 1);
+ debug ("Read module type=<0x%x>", *buffer);
+
+ MO_write ("\3765", 2); // read serial number
+ usleep(100000);
+ MO_read (buffer, 2);
+ debug ("Serial Number=<0x%x>", *(short*)buffer);
+
+ MO_write ("\3766", 2); // read version number
+ usleep(100000);
+ MO_read (buffer, 1);
+ debug ("Version number=<0x%x>", *buffer);
+
+
+ #endif
+
return 0;
}
tr class='logheader'>2014-10-15Imported Upstream version 0+git20141009.d26b627upstream/0+git20141009.d26b627Jonathan McCrohan2010-11120/+159271 2014-07-23Release 0+git20140611.14bd6c7-1debian/0+git20140611.14bd6c7-1Jonathan McCrohan1-2/+2 2014-07-23New Upstream Snapshot (commit 14bd6c7)Jonathan McCrohan1-2/+3 2014-07-23Imported Upstream version 0+git20140611.14bd6c7upstream/0+git20140611.14bd6c7Jonathan McCrohan7-11/+60 2014-05-13New Upstream Snapshot (commit 1246b27)Jonathan McCrohan1-0/+6 2014-05-13Imported Upstream version 0+git20140512.1246b27upstream/0+git20140512.1246b27Jonathan McCrohan391-301/+3983 2014-04-05Release 0+git20140326.cfc2975-1debian/0+git20140326.cfc2975-1Jonathan McCrohan1-2/+2 2014-04-05d/control: update Homepage (upstream has moved from Gitweb to cgit)Jonathan McCrohan2-1/+2 2014-04-05New Upstream Snapshot (commit cfc2975)Jonathan McCrohan1-0/+6 2014-04-05Imported Upstream version 0+git20140326.cfc2975upstream/0+git20140326.cfc2975Jonathan McCrohan118-656/+877 2014-01-16Release 0+git20140107.1850cf8-1debian/0+git20140107.1850cf8-1Jonathan McCrohan1-2/+2 2014-01-16Update Standards Version to 3.9.5Jonathan McCrohan2-1/+9 No changes required