aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in16
-rwxr-xr-xconfigure4
-rw-r--r--configure.in4
-rw-r--r--drv.c13
-rw-r--r--drv_Crystalfontz.c292
-rw-r--r--drv_MatrixOrbital.c23
7 files changed, 327 insertions, 27 deletions
diff --git a/Makefile.am b/Makefile.am
index 486ac94..89d3d42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -85,7 +85,7 @@ udelay.c udelay.h
EXTRA_lcd4linux_SOURCES= \
parport.c parport.h \
BeckmannEgle.c \
-Crystalfontz.c \
+drv_Crystalfontz.c Crystalfontz.c \
Cwlinux.c \
HD44780.c \
M50530.c \
diff --git a/Makefile.in b/Makefile.in
index 0ebe621..d2ceea4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -125,7 +125,7 @@ lcd4linux_SOURCES = lcd4linux.c pid.c pid.h hash.c hash.h parser.c parser.h pro
#fontmap.c fontmap.h \
#udelay.c udelay.h
-EXTRA_lcd4linux_SOURCES = parport.c parport.h BeckmannEgle.c Crystalfontz.c Cwlinux.c HD44780.c M50530.c T6963.c USBLCD.c drv_MatrixOrbital.c MatrixOrbital.c MilfordInstruments.c PalmPilot.c Raster.c SIN.c XWindow.c Text.c
+EXTRA_lcd4linux_SOURCES = parport.c parport.h BeckmannEgle.c drv_Crystalfontz.c Crystalfontz.c Cwlinux.c HD44780.c M50530.c T6963.c USBLCD.c drv_MatrixOrbital.c MatrixOrbital.c MilfordInstruments.c PalmPilot.c Raster.c SIN.c XWindow.c Text.c
EXTRA_DIST = lcd4linux.conf.sample lcd4kde.conf lcd4linux.kdelnk lcd4linux.xpm lcd4linux.lsm curses.m4 AUTHORS CREDITS FAQ NEWS TODO README README.Rows README.Tokens README.Drivers README.Plugins README.KDE Skeleton.c plugin_sample.c
@@ -181,13 +181,13 @@ DEP_FILES = .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/Cwlinux.P \
.deps/MilfordInstruments.P .deps/PalmPilot.P .deps/Raster.P .deps/SIN.P \
.deps/T6963.P .deps/Text.P .deps/USBLCD.P .deps/XWindow.P .deps/bar.P \
.deps/battery.P .deps/cfg.P .deps/debug.P .deps/display.P .deps/drv.P \
-.deps/drv_MatrixOrbital.P .deps/drv_generic_parport.P \
-.deps/drv_generic_serial.P .deps/drv_generic_text.P .deps/dvb.P \
-.deps/evaluator.P .deps/exec.P .deps/expr.P .deps/filter.P \
-.deps/fontmap.P .deps/hash.P .deps/icon.P .deps/imon.P .deps/isdn.P \
-.deps/layout.P .deps/lcd4linux.P .deps/lock.P .deps/mail.P \
-.deps/mail2.P .deps/parport.P .deps/parser.P .deps/pid.P .deps/pixmap.P \
-.deps/plugin.P .deps/plugin_cfg.P .deps/plugin_cpuinfo.P \
+.deps/drv_Crystalfontz.P .deps/drv_MatrixOrbital.P \
+.deps/drv_generic_parport.P .deps/drv_generic_serial.P \
+.deps/drv_generic_text.P .deps/dvb.P .deps/evaluator.P .deps/exec.P \
+.deps/expr.P .deps/filter.P .deps/fontmap.P .deps/hash.P .deps/icon.P \
+.deps/imon.P .deps/isdn.P .deps/layout.P .deps/lcd4linux.P .deps/lock.P \
+.deps/mail.P .deps/mail2.P .deps/parport.P .deps/parser.P .deps/pid.P \
+.deps/pixmap.P .deps/plugin.P .deps/plugin_cfg.P .deps/plugin_cpuinfo.P \
.deps/plugin_i2c_sensors.P .deps/plugin_loadavg.P .deps/plugin_math.P \
.deps/plugin_meminfo.P .deps/plugin_proc_stat.P .deps/plugin_string.P \
.deps/plugin_uname.P .deps/plugin_xmms.P .deps/processor.P .deps/seti.P \
diff --git a/configure b/configure
index d10c787..67ced11 100755
--- a/configure
+++ b/configure
@@ -20945,8 +20945,8 @@ _ACEOF
fi
if test "$CRYSTALFONTZ" = "yes"; then
-# DRIVERS="$DRIVERS Crystalfontz.lo"
- DRIVERS="$DRIVERS Crystalfontz.o"
+# DRIVERS="$DRIVERS Crystalfontz.lo drv_Crystalfontz.lo"
+ DRIVERS="$DRIVERS Crystalfontz.o drv_Crystalfontz.o"
cat >>confdefs.h <<\_ACEOF
#define WITH_CRYSTALFONTZ 1
diff --git a/configure.in b/configure.in
index 3b6ee0a..6031ea2 100644
--- a/configure.in
+++ b/configure.in
@@ -146,8 +146,8 @@ if test "$BECKMANNEGLE" = "yes"; then
fi
if test "$CRYSTALFONTZ" = "yes"; then
-# DRIVERS="$DRIVERS Crystalfontz.lo"
- DRIVERS="$DRIVERS Crystalfontz.o"
+# DRIVERS="$DRIVERS Crystalfontz.lo drv_Crystalfontz.lo"
+ DRIVERS="$DRIVERS Crystalfontz.o drv_Crystalfontz.o"
AC_DEFINE(WITH_CRYSTALFONTZ,1,[junk])
fi
diff --git a/drv.c b/drv.c
index f091dbf..4a16fca 100644
--- a/drv.c
+++ b/drv.c
@@ -1,4 +1,4 @@
-/* $Id: drv.c,v 1.3 2004/01/20 15:32:49 reinelt Exp $
+/* $Id: drv.c,v 1.4 2004/01/21 12:36:19 reinelt Exp $
*
* new framework for display drivers
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv.c,v $
+ * Revision 1.4 2004/01/21 12:36:19 reinelt
+ * Crystalfontz NextGeneration driver added
+ *
* Revision 1.3 2004/01/20 15:32:49 reinelt
* first version of Next Generation HD44780 (untested! but it compiles...)
* some cleanup in the other drivers
@@ -110,9 +113,11 @@ DRIVER *Driver[] = {
#ifdef WITH_BECKMANNEGLE
&BeckmannEgle,
#endif
- #ifdef WITH_CRYSTALFONTZ
- &Crystalfontz,
- #endif
+ */
+#ifdef WITH_CRYSTALFONTZ
+ &drv_Crystalfontz,
+#endif
+ /* Fixme
#ifdef WITH_CWLINUX
&Cwlinux,
#endif
diff --git a/drv_Crystalfontz.c b/drv_Crystalfontz.c
new file mode 100644
index 0000000..5c3bf1b
--- /dev/null
+++ b/drv_Crystalfontz.c
@@ -0,0 +1,292 @@
+/* $Id: drv_Crystalfontz.c,v 1.1 2004/01/21 12:36:19 reinelt Exp $
+ *
+ * new style driver for Crystalfontz display modules
+ *
+ * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ * $Log: drv_Crystalfontz.c,v $
+ * Revision 1.1 2004/01/21 12:36:19 reinelt
+ * Crystalfontz NextGeneration driver added
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_Crystalfontz
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "plugin.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_bar.h"
+#include "drv.h"
+#include "drv_generic_text.h"
+#include "drv_generic_serial.h"
+
+
+static char Name[]="Crystalfontz";
+
+static int Model;
+
+// Fixme: do we need PROTOCOL?
+static int GPOS, ICONS, PROTOCOL;
+
+// Fixme:
+// static int GPO[8];
+
+
+typedef struct {
+ int type;
+ char *name;
+ int rows;
+ int cols;
+ int gpos;
+ int protocol;
+} MODEL;
+
+// Fixme #1: number of gpo's should be verified
+// Fixme #2: protocol should be verified
+// Fixme #3: do CF displays have type numbers?
+
+static MODEL Models[] = {
+ { 0x26, "626", 2, 16, 0, 1 },
+ { 0x32, "632", 2, 16, 0, 1 },
+ { 0x34, "634", 4, 20, 0, 1 },
+ { 0x36, "636", 2, 16, 0, 1 },
+ { 0xff, "Unknown", -1, -1, 0, 0 }
+};
+
+
+// ****************************************
+// *** hardware dependant functions ***
+// ****************************************
+
+static void drv_CF_goto (int row, int col)
+{
+ char cmd[3]="\021xy"; // set cursor position
+
+ if (row==0 && col==0) {
+ drv_generic_serial_write("\001", 1); // cursor home
+ } else {
+ cmd[1]=(char)col;
+ cmd[2]=(char)row;
+ drv_generic_serial_write(cmd, 3);
+ }
+}
+
+
+static void drv_CF_define_char (int ascii, char *buffer)
+{
+ char cmd[2]="\031n"; // set custom char bitmap
+
+ cmd[1]=(char)ascii;
+ drv_generic_serial_write (cmd, 2);
+ drv_generic_serial_write (buffer, 8);
+}
+
+
+static int drv_CF_start (char *section)
+{
+ int i;
+ char *model;
+
+ model=cfg_get(section, "Model", NULL);
+ if (model!=NULL && *model!='\0') {
+ for (i=0; Models[i].type!=0xff; i++) {
+ if (strcasecmp(Models[i].name, model)==0) break;
+ }
+ if (Models[i].type==0xff) {
+ error ("%s: %s.Model '%s' is unknown from %s", Name, section, model, cfg_source());
+ return -1;
+ }
+ Model=i;
+ info ("%s: using model '%s'", Name, Models[Model].name);
+ } else {
+ error ("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ // initialize global variables
+ DROWS = Models[Model].rows;
+ DCOLS = Models[Model].cols;
+ GPOS = Models[Model].gpos;
+ PROTOCOL = Models[Model].protocol;
+
+ // open serial port
+ if (drv_generic_serial_open(section, Name)<0) return -1;
+
+ // MR: why such a large delay?
+ usleep(350*1000);
+
+ drv_generic_serial_write ("\014", 1); // Form Feed (Clear Display)
+ drv_generic_serial_write ("\004", 1); // hide cursor
+ drv_generic_serial_write ("\024", 1); // scroll off
+ drv_generic_serial_write ("\030", 1); // wrap off
+
+ return 0;
+}
+
+
+// ****************************************
+// *** plugins ***
+// ****************************************
+
+
+static void plugin_contrast (RESULT *result, RESULT *arg1)
+{
+ char buffer[3];
+ double contrast;
+
+ contrast=R2N(arg1);
+ if (contrast<0 ) contrast=0;
+ if (contrast>100) contrast=100;
+
+ snprintf (buffer, 3, "\017%c", (int)contrast);
+ drv_generic_serial_write (buffer, 2);
+
+ SetResult(&result, R_NUMBER, &contrast);
+}
+
+
+static void plugin_backlight (RESULT *result, RESULT *arg1)
+{
+ char buffer[3];
+ double backlight;
+
+ backlight=R2N(arg1);
+ if (backlight<0 ) backlight=0;
+ if (backlight>100) backlight=100;
+
+ snprintf (buffer, 4, "\016%c", (int)backlight);
+ drv_generic_serial_write (buffer, 3);
+
+ SetResult(&result, R_NUMBER, &backlight);
+}
+
+// Fixme: other plugins for Fans, Temmperature sensors, ...
+
+
+// ****************************************
+// *** widget callbacks ***
+// ****************************************
+
+
+int drv_CF_draw_text (WIDGET *W)
+{
+ return drv_generic_text_draw_text(W, 4, drv_CF_goto, drv_generic_serial_write);
+}
+
+
+int drv_CF_draw_bar (WIDGET *W)
+{
+ return drv_generic_text_draw_bar(W, 4, drv_CF_define_char, drv_CF_goto, drv_generic_serial_write);
+}
+
+
+// ****************************************
+// *** exported functions ***
+// ****************************************
+
+
+// list models
+int drv_CF_list (void)
+{
+ int i;
+
+ for (i=0; Models[i].type!=0xff; i++) {
+ printf ("%s ", Models[i].name);
+ }
+ return 0;
+}
+
+
+// initialize driver & display
+int drv_CF_init (char *section)
+{
+ WIDGET_CLASS wc;
+ int ret;
+
+ XRES=5;
+ YRES=8;
+ CHARS=8;
+
+ // start display
+ if ((ret=drv_CF_start (section))!=0)
+ return ret;
+
+ // initialize generic text driver
+ if ((ret=drv_generic_text_init(Name))!=0)
+ return ret;
+
+ // initialize generic bar driver
+ if ((ret=drv_generic_text_bar_init())!=0)
+ return ret;
+
+ // add fixed chars to the bar driver
+ drv_generic_text_bar_add_segment ( 0, 0,255, 32); // ASCII 32 = blank
+ drv_generic_text_bar_add_segment (255,255,255,255); // ASCII 255 = block
+
+ // register text widget
+ wc=Widget_Text;
+ wc.draw=drv_CF_draw_text;
+ widget_register(&wc);
+
+ // register bar widget
+ wc=Widget_Bar;
+ wc.draw=drv_CF_draw_bar;
+ widget_register(&wc);
+
+ // register plugins
+ AddFunction ("contrast", 1, plugin_contrast);
+ AddFunction ("backlight", 1, plugin_backlight);
+
+ return 0;
+}
+
+
+// close driver & display
+int drv_CF_quit (void) {
+
+ info("%s: shutting down.", Name);
+ drv_generic_serial_close();
+ drv_generic_text_quit();
+
+ return (0);
+}
+
+
+DRIVER drv_Crystalfontz = {
+ name: Name,
+ list: drv_CF_list,
+ init: drv_CF_init,
+ quit: drv_CF_quit,
+};
+
diff --git a/drv_MatrixOrbital.c b/drv_MatrixOrbital.c
index 5c916e1..3a20bfb 100644
--- a/drv_MatrixOrbital.c
+++ b/drv_MatrixOrbital.c
@@ -1,4 +1,4 @@
-/* $Id: drv_MatrixOrbital.c,v 1.14 2004/01/20 15:32:49 reinelt Exp $
+/* $Id: drv_MatrixOrbital.c,v 1.15 2004/01/21 12:36:19 reinelt Exp $
*
* new style driver for Matrix Orbital serial display modules
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv_MatrixOrbital.c,v $
+ * Revision 1.15 2004/01/21 12:36:19 reinelt
+ * Crystalfontz NextGeneration driver added
+ *
* Revision 1.14 2004/01/20 15:32:49 reinelt
* first version of Next Generation HD44780 (untested! but it compiles...)
* some cleanup in the other drivers
@@ -164,6 +167,15 @@ static MODEL Models[] = {
// *** hardware dependant functions ***
// ****************************************
+static void drv_MO_goto (int row, int col)
+{
+ char cmd[5]="\376Gyx";
+ cmd[2]=(char)col+1;
+ cmd[3]=(char)row+1;
+ drv_generic_serial_write(cmd,4);
+}
+
+
static void drv_MO_define_char (int ascii, char *buffer)
{
char cmd[3]="\376N";
@@ -174,15 +186,6 @@ static void drv_MO_define_char (int ascii, char *buffer)
}
-static void drv_MO_goto (int row, int col)
-{
- char cmd[5]="\376Gyx";
- cmd[2]=(char)col+1;
- cmd[3]=(char)row+1;
- drv_generic_serial_write(cmd,4);
-}
-
-
static int drv_MO_start (char *section)
{
int i;