aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <>2000-03-22 15:36:21 +0000
committerreinelt <>2000-03-22 15:36:21 +0000
commitaf243c0321c8eff1fcf1384d105333ae4e243f67 (patch)
treecb85a9ee9f8f4adf8c61077573e696c1527f4ac5
parent26521bed933853a430ccb086524bd5bb9d2a78ba (diff)
downloadlcd4linux-af243c0321c8eff1fcf1384d105333ae4e243f67.tar.gz
[lcd4linux @ 2000-03-22 15:36:21 by reinelt]
added '-l' switch (list drivers) generic pixmap driver added X11 Framework done
-rw-r--r--Makefile.am5
-rw-r--r--Makefile.in12
-rw-r--r--XWindow.c115
-rw-r--r--display.c33
-rw-r--r--display.h9
-rw-r--r--fontmap.c837
-rw-r--r--lcd4linux.c16
-rw-r--r--lcd4linux.conf.sample14
-rw-r--r--pixmap.c165
-rw-r--r--pixmap.h44
10 files changed, 1231 insertions, 19 deletions
diff --git a/Makefile.am b/Makefile.am
index 86e6be1..443f527 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,10 @@ lcd4linux_SOURCES = \
isdn.c isdn.h \
filter.c filter.h \
display.c display.h \
+ pixmap.c pixmap.h \
+ fontmap.c fontmap.h \
Skeleton.c \
- MatrixOrbital.c
+ MatrixOrbital.c \
+ XWindow.c
diff --git a/Makefile.in b/Makefile.in
index 9231301..0bb3143 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -68,7 +68,7 @@ CLEANFILES = *~
AM_CFLAGS = -Wall
bin_PROGRAMS = lcd4linux
-lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h parser.c parser.h processor.c processor.h system.c system.h isdn.c isdn.h filter.c filter.h display.c display.h Skeleton.c MatrixOrbital.c
+lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h parser.c parser.h processor.c processor.h system.c system.h isdn.c isdn.h filter.c filter.h display.c display.h pixmap.c pixmap.h fontmap.c fontmap.h Skeleton.c MatrixOrbital.c XWindow.c
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -81,7 +81,8 @@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
lcd4linux_OBJECTS = lcd4linux.o cfg.o parser.o processor.o system.o \
-isdn.o filter.o display.o Skeleton.o MatrixOrbital.o
+isdn.o filter.o display.o pixmap.o fontmap.o Skeleton.o MatrixOrbital.o \
+XWindow.o
lcd4linux_LDADD = $(LDADD)
lcd4linux_DEPENDENCIES =
lcd4linux_LDFLAGS =
@@ -97,9 +98,10 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
-DEP_FILES = .deps/MatrixOrbital.P .deps/Skeleton.P .deps/cfg.P \
-.deps/display.P .deps/filter.P .deps/isdn.P .deps/lcd4linux.P \
-.deps/parser.P .deps/processor.P .deps/system.P
+DEP_FILES = .deps/MatrixOrbital.P .deps/Skeleton.P .deps/XWindow.P \
+.deps/cfg.P .deps/display.P .deps/filter.P .deps/fontmap.P .deps/isdn.P \
+.deps/lcd4linux.P .deps/parser.P .deps/pixmap.P .deps/processor.P \
+.deps/system.P
SOURCES = $(lcd4linux_SOURCES)
OBJECTS = $(lcd4linux_OBJECTS)
diff --git a/XWindow.c b/XWindow.c
new file mode 100644
index 0000000..259caf8
--- /dev/null
+++ b/XWindow.c
@@ -0,0 +1,115 @@
+/* $Id: XWindow.c,v 1.1 2000/03/22 15:36:21 reinelt Exp $
+ *
+ * driver for X11
+ *
+ * Copyright 1999, 2000 by Michael Reinelt (reinelt@eunet.at)
+ *
+ * This program 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.
+ *
+ * This program 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: XWindow.c,v $
+ * Revision 1.1 2000/03/22 15:36:21 reinelt
+ *
+ * added '-l' switch (list drivers)
+ * generic pixmap driver added
+ * X11 Framework done
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DISPLAY XWindow[]
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "cfg.h"
+#include "display.h"
+#include "pixmap.h"
+
+#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 )
+
+static DISPLAY Display;
+
+int X_flush (void)
+{
+ int r, c;
+
+ for (r=0; r<Display.rows*Display.yres; r++) {
+ for (c=0; c<Display.cols*Display.xres; c++) {
+ printf ("%c", Pixmap[r*Display.cols*Display.xres+c] ? '#':'.');
+ }
+ printf ("\n");
+ }
+ printf ("\n");
+ return 0;
+}
+
+int X_clear (void)
+{
+ if (pix_clear()!=0)
+ return -1;
+
+ if (X_flush()!=0)
+ return -1;
+
+ return 0;
+}
+
+int X_init (DISPLAY *Self)
+{
+ int rows=-1;
+ int cols=-1;
+
+ rows=atoi(cfg_get("rows"));
+ cols=atoi(cfg_get("columns"));
+
+ if (rows<1 || cols<1) {
+ fprintf (stderr, "X11: incorrect number of rows or columns\n");
+ return -1;
+ }
+
+ if (pix_init (rows, cols)!=0) {
+ fprintf (stderr, "X11: pix_init(%d, %d) failed\n", rows, cols);
+ return -1;
+ }
+
+ Self->rows=rows;
+ Self->cols=cols;
+ Display=*Self;
+
+ pix_clear();
+ return 0;
+}
+
+int X_put (int row, int col, char *text)
+{
+ return pix_put (row, col, text);
+}
+
+int X_bar (int type, int row, int col, int max, int len1, int len2)
+{
+ return pix_bar (type, row, col, max, len1, len2);
+}
+
+
+DISPLAY XWindow[] = {
+ { "X11", 0, 0, XRES, YRES, BARS, X_init, X_clear, X_put, X_bar, X_flush },
+ { "" }
+};
diff --git a/display.c b/display.c
index 113babc..c06f36a 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.8 2000/03/19 08:41:28 reinelt Exp $
+/* $Id: display.c,v 1.9 2000/03/22 15:36:21 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,12 @@
*
*
* $Log: display.c,v $
+ * Revision 1.9 2000/03/22 15:36:21 reinelt
+ *
+ * added '-l' switch (list drivers)
+ * generic pixmap driver added
+ * X11 Framework done
+ *
* Revision 1.8 2000/03/19 08:41:28 reinelt
*
* documentation available! README, README.MatrixOrbital, README.Drivers
@@ -58,6 +64,9 @@
/*
* exported functions:
*
+ * lcd_list (void)
+ * lists all available drivers to stdout
+ *
* lcd_init (char *display)
* initializes the named driver
*
@@ -87,16 +96,34 @@
extern DISPLAY Skeleton[];
extern DISPLAY MatrixOrbital[];
+extern DISPLAY XWindow[];
FAMILY Driver[] = {
- { "Skeleton", Skeleton },
- { "MatrixOrbital", MatrixOrbital },
+ { "Skeleton", Skeleton },
+ { "Matrix Orbital", MatrixOrbital },
+ { "X Window System", XWindow },
{ "" }
};
static DISPLAY *Display = NULL;
+int lcd_list (void)
+{
+ int i, j;
+
+ printf ("available display drivers:");
+
+ for (i=0; Driver[i].name[0]; i++) {
+ printf ("\n %-16s:", Driver[i].name);
+ for (j=0; Driver[i].Display[j].name[0]; j++) {
+ printf (" %s", Driver[i].Display[j].name);
+ }
+ }
+ printf ("\n");
+ return 0;
+}
+
int lcd_init (char *display)
{
int i, j;
diff --git a/display.h b/display.h
index 937d030..208ba83 100644
--- a/display.h
+++ b/display.h
@@ -1,4 +1,4 @@
-/* $Id: display.h,v 1.7 2000/03/17 09:21:42 reinelt Exp $
+/* $Id: display.h,v 1.8 2000/03/22 15:36:21 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,12 @@
*
*
* $Log: display.h,v $
+ * Revision 1.8 2000/03/22 15:36:21 reinelt
+ *
+ * added '-l' switch (list drivers)
+ * generic pixmap driver added
+ * X11 Framework done
+ *
* Revision 1.7 2000/03/17 09:21:42 reinelt
*
* various memory statistics added
@@ -81,6 +87,7 @@ typedef struct {
DISPLAY *Display;
} FAMILY;
+int lcd_list (void);
int lcd_init (char *display);
int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars);
int lcd_clear (void);
diff --git a/fontmap.c b/fontmap.c
new file mode 100644
index 0000000..e8494ae
--- /dev/null
+++ b/fontmap.c
@@ -0,0 +1,837 @@
+/* $Id: fontmap.c,v 1.1 2000/03/22 15:36:21 reinelt Exp $
+ *
+ * 5x8 font
+ *
+ * Copyright 1999, 2000 by Michael Reinelt (reinelt@eunet.at)
+ *
+ * This program 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.
+ *
+ * This program 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: fontmap.c,v $
+ * Revision 1.1 2000/03/22 15:36:21 reinelt
+ *
+ * added '-l' switch (list drivers)
+ * generic pixmap driver added
+ * X11 Framework done
+ *
+ */
+
+#include "pixmap.h"
+#include "fontmap.h"
+
+#define b______ 0x00
+#define b_____O 0x01
+#define b____O_ 0x02
+#define b____OO 0x03
+#define b___O__ 0x04
+#define b___O_O 0x05
+#define b___OO_ 0x06
+#define b___OOO 0x07
+#define b__O___ 0x08
+#define b__O__O 0x09
+#define b__O_O_ 0x0a
+#define b__O_OO 0x0b
+#define b__OO__ 0x0c
+#define b__OO_O 0x0d
+#define b__OOO_ 0x0e
+#define b__OOOO 0x0f
+#define b_O____ 0x10
+#define b_O___O 0x11
+#define b_O__O_ 0x12
+#define b_O__OO 0x13
+#define b_O_O__ 0x14
+#define b_O_O_O 0x15
+#define b_O_OO_ 0x16
+#define b_O_OOO 0x17
+#define b_OO___ 0x18
+#define b_OO__O 0x19
+#define b_OO_O_ 0x1a
+#define b_OO_OO 0x1b
+#define b_OOO__ 0x1c
+#define b_OOO_O 0x1d
+#define b_OOOO_ 0x1e
+#define b_OOOOO 0x1f
+
+unsigned char Fontmap[256][8]={
+ [0x20] { b______,
+ b______,
+ b______,
+ b______,
+ b______,
+ b______,
+ b______,
+ b______ },
+ [0x21] { b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b______,
+ b______,
+ b___O__,
+ b______ },
+ [0x22] { b__O_O_,
+ b__O_O_,
+ b__O_O_,
+ b______,
+ b______,
+ b______,
+ b______,
+ b______ },
+ [0x23] { b__O_O_,
+ b__O_O_,
+ b_OOOOO,
+ b__O_O_,
+ b_OOOOO,
+ b__O_O_,
+ b__O_O_,
+ b______ },
+ [0x24] { b___O__,
+ b__OOOO,
+ b_O_O__,
+ b__OOO_,
+ b___O_O,
+ b_OOOO_,
+ b___O__,
+ b______ },
+ [0x25] { b_OO___,
+ b_OO__O,
+ b____O_,
+ b___O__,
+ b__O___,
+ b_O__OO,
+ b____OO,
+ b______ },
+ [0x26] { b__OO__,
+ b_O__O_,
+ b_O_O__,
+ b__O___,
+ b_O_O_O,
+ b_O__O_,
+ b__OO_O,
+ b______ },
+ [0x27] { b__OO__,
+ b___O__,
+ b__O___,
+ b______,
+ b______,
+ b______,
+ b______,
+ b______ },
+ [0x28] { b____O_,
+ b___O__,
+ b__O___,
+ b__O___,
+ b__O___,
+ b___O__,
+ b____O_,
+ b______ },
+ [0x29] { b__O___,
+ b___O__,
+ b____O_,
+ b____O_,
+ b____O_,
+ b___O__,
+ b__O___,
+ b______ },
+ [0x2a] { b______,
+ b___O__,
+ b_O_O_O,
+ b__OOO_,
+ b_O_O_O,
+ b___O__,
+ b______,
+ b______ },
+ [0x2b] { b______,
+ b___O__,
+ b___O__,
+ b_OOOOO,
+ b___O__,
+ b___O__,
+ b______,
+ b______ },
+ [0x2c] { b______,
+ b______,
+ b______,
+ b______,
+ b__OO__,
+ b___O__,
+ b__O___,
+ b______ },
+ [0x2d] { b______,
+ b______,
+ b______,
+ b_OOOOO,
+ b______,
+ b______,
+ b______,
+ b______ },
+ [0x2e] { b______,
+ b______,
+ b______,
+ b______,
+ b______,
+ b__OO__,
+ b__OO__,
+ b______ },
+ [0x2f] { b______,
+ b_____O,
+ b____O_,
+ b___O__,
+ b__O___,
+ b_O____,
+ b______,
+ b______ },
+ [0x30] { b__OOO_,
+ b_O___O,
+ b_O__OO,
+ b_O_O_O,
+ b_OO__O,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x31] { b___O__,
+ b__OO__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b__OOO_,
+ b______ },
+ [0x32] { b__OOO_,
+ b_O___O,
+ b_____O,
+ b____O_,
+ b___O__,
+ b__O___,
+ b_OOOOO,
+ b______ },
+ [0x33] { b_OOOOO,
+ b____O_,
+ b___O__,
+ b____O_,
+ b_____O,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x34] { b____O_,
+ b___OO_,
+ b__O_O_,
+ b_O__O_,
+ b_OOOOO,
+ b____O_,
+ b____O_,
+ b______ },
+ [0x35] { b_OOOOO,
+ b_O____,
+ b_O____,
+ b_OOOO_,
+ b_____O,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x36] { b___OO_,
+ b__O___,
+ b_O____,
+ b_OOOO_,
+ b_O___O,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x37] { b_OOOOO,
+ b_____O,
+ b____O_,
+ b___O__,
+ b__O___,
+ b__O___,
+ b__O___,
+ b______ },
+ [0x38] { b__OOO_,
+ b_O___O,
+ b_O___O,
+ b__OOO_,
+ b_O___O,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x39] { b__OOO_,
+ b_O___O,
+ b_O___O,
+ b__OOOO,
+ b_____O,
+ b____O_,
+ b__OO__,
+ b______ },
+ [0x3a] { b______,
+ b__OO__,
+ b__OO__,
+ b______,
+ b__OO__,
+ b__OO__,
+ b______,
+ b______ },
+ [0x3b] { b______,
+ b__OO__,
+ b__OO__,
+ b______,
+ b__OO__,
+ b___O__,
+ b__O___,
+ b______ },
+ [0x3c] { b____O_,
+ b___O__,
+ b__O___,
+ b_O____,
+ b__O___,
+ b___O__,
+ b____O_,
+ b______ },
+ [0x3d] { b______,
+ b______,
+ b_OOOOO,
+ b______,
+ b_OOOOO,
+ b______,
+ b______,
+ b______ },
+ [0x3e] { b_O____,
+ b__O___,
+ b___O__,
+ b____O_,
+ b___O__,
+ b__O___,
+ b_O____,
+ b______ },
+ [0x3f] { b__OOO_,
+ b_O___O,
+ b_____O,
+ b____O_,
+ b___O__,
+ b______,
+ b___O__,
+ b______ },
+ [0x40] { b__OOO_,
+ b_O___O,
+ b_____O,
+ b__OO_O,
+ b_O_O_O,
+ b_O_O_O,
+ b__OOO_,
+ b______ },
+ [0x41] { b__OOO_,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_OOOOO,
+ b_O___O,
+ b_O___O,
+ b______ },
+ [0x42] { b_OOOO_,
+ b_O___O,
+ b_O___O,
+ b_OOOO_,
+ b_O___O,
+ b_O___O,
+ b_OOOO_,
+ b______ },
+ [0x43] { b__OOO_,
+ b_O___O,
+ b_O____,
+ b_O____,
+ b_O____,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x44] { b_OOO__,
+ b_O__O_,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O__O_,
+ b_OOO__,
+ b______ },
+ [0x45] { b_OOOOO,
+ b_O____,
+ b_O____,
+ b_OOOO_,
+ b_O____,
+ b_O____,
+ b_OOOOO,
+ b______ },
+ [0x46] { b_OOOOO,
+ b_O____,
+ b_O____,
+ b_OOOO_,
+ b_O____,
+ b_O____,
+ b_O____,
+ b______ },
+ [0x47] { b__OOO_,
+ b_O___O,
+ b_O____,
+ b_O_OOO,
+ b_O___O,
+ b_O___O,
+ b__OOOO,
+ b______ },
+ [0x48] { b_O___O,
+ b_O___O,
+ b_O___O,
+ b_OOOOO,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b______ },
+ [0x49] { b__OOO_,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b__OOO_,
+ b______ },
+ [0x4a] { b___OOO,
+ b____O_,
+ b____O_,
+ b____O_,
+ b____O_,
+ b_O__O_,
+ b__OO__,
+ b______ },
+ [0x4b] { b_O___O,
+ b_O__O_,
+ b_O_O__,
+ b_OO___,
+ b_O_O__,
+ b_O__O_,
+ b_O___O,
+ b______ },
+ [0x4c] { b_O____,
+ b_O____,
+ b_O____,
+ b_O____,
+ b_O____,
+ b_O____,
+ b_OOOOO,
+ b______ },
+ [0x4d] { b_O___O,
+ b_OO_OO,
+ b_O_O_O,
+ b_O_O_O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b______ },
+ [0x4e] { b_O___O,
+ b_O___O,
+ b_OO__O,
+ b_O_O_O,
+ b_O__OO,
+ b_O___O,
+ b_O___O,
+ b______ },
+ [0x4f] { b__OOO_,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x50] { b_OOOO_,
+ b_O___O,
+ b_O___O,
+ b_OOOO_,
+ b_O____,
+ b_O____,
+ b_O____,
+ b______ },
+ [0x51] { b__OOO_,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O_O_O,
+ b_O__O_,
+ b__OO_O,
+ b______ },
+ [0x52] { b_OOOO_,
+ b_O___O,
+ b_O___O,
+ b_OOOO_,
+ b_O_O__,
+ b_O__O_,
+ b_O___O,
+ b______ },
+ [0x53] { b__OOOO,
+ b_O____,
+ b_O____,
+ b__OOO_,
+ b_____O,
+ b_____O,
+ b_OOOO_,
+ b______ },
+ [0x54] { b_OOOOO,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b______ },
+ [0x55] { b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x56] { b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b__O_O_,
+ b___O__,
+ b______ },
+ [0x57] { b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O_O_O,
+ b_O_O_O,
+ b_O_O_O,
+ b__O_O_,
+ b______ },
+ [0x58] { b_O___O,
+ b_O___O,
+ b__O_O_,
+ b___O__,
+ b__O_O_,
+ b_O___O,
+ b_O___O,
+ b______ },
+ [0x59] { b_O___O,
+ b_O___O,
+ b_O___O,
+ b__O_O_,
+ b___O__,
+ b___O__,
+ b___O__,
+ b______ },
+ [0x5a] { b_OOOOO,
+ b_____O,
+ b____O_,
+ b___O__,
+ b__O___,
+ b_O____,
+ b_OOOOO,
+ b______ },
+ [0x5b] { b__OOO_,
+ b__O___,
+ b__O___,
+ b__O___,
+ b__O___,
+ b__O___,
+ b__OOO_,
+ b______ },
+ [0x5c] { b_O___O,
+ b__O_O_,
+ b_OOOOO,
+ b___O__,
+ b_OOOOO,
+ b___O__,
+ b___O__,
+ b______ },
+ [0x5d] { b__OOO_,
+ b____O_,
+ b____O_,
+ b____O_,
+ b____O_,
+ b____O_,
+ b__OOO_,
+ b______ },
+ [0x5e] { b___O__,
+ b__O_O_,
+ b_O___O,
+ b______,
+ b______,
+ b______,
+ b______,
+ b______ },
+ [0x5f] { b______,
+ b______,
+ b______,
+ b______,
+ b______,
+ b______,
+ b_OOOOO,
+ b______ },
+ [0x60] { b__O___,
+ b___O__,
+ b____O_,
+ b______,
+ b______,
+ b______,
+ b______,
+ b______ },
+ [0x61] { b______,
+ b______,
+ b__OOO_,
+ b_____O,
+ b__OOOO,
+ b_O___O,
+ b__OOOO,
+ b______ },
+ [0x62] { b_O____,
+ b_O____,
+ b_O____,
+ b_O_OO_,
+ b_OO__O,
+ b_O___O,
+ b_OOOO_,
+ b______ },
+ [0x63] { b______,
+ b______,
+ b__OOO_,
+ b_O____,
+ b_O____,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x64] { b_____O,
+ b_____O,
+ b_____O,
+ b__OO_O,
+ b_O__OO,
+ b_O___O,
+ b__OOOO,
+ b______ },
+ [0x65] { b______,
+ b______,
+ b__OOO_,
+ b_O___O,
+ b_OOOOO,
+ b_O____,
+ b__OOO_,
+ b______ },
+ [0x66] { b___OO_,
+ b__O__O,
+ b__O___,
+ b_OOO__,
+ b__O___,
+ b__O___,
+ b__O___,
+ b______ },
+ [0x67] { b______,
+ b__OOOO,
+ b_O___O,
+ b_O___O,
+ b__OOOO,
+ b_____O,
+ b__OOO_,
+ b______ },
+ [0x68] { b_O____,
+ b_O____,
+ b_O_OO_,
+ b_OO__O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b______ },
+ [0x69] { b______,
+ b___O__,
+ b______,
+ b__OO__,
+ b___O__,
+ b___O__,
+ b__OOO_,
+ b______ },
+ [0x6a] { b____O_,
+ b______,
+ b___OO_,
+ b____O_,
+ b____O_,
+ b_O__O_,
+ b__OO__,
+ b______ },
+ [0x6b] { b__O___,
+ b__O___,
+ b__O__O,
+ b__O_O_,
+ b__OO__,
+ b__O_O_,
+ b__O__O,
+ b______ },
+ [0x6c] { b__OO__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b__OOO_,
+ b______ },
+ [0x6d] { b______,
+ b______,
+ b_OO_O_,
+ b_O_O_O,
+ b_O_O_O,
+ b_O___O,
+ b_O___O,
+ b______ },
+ [0x6e] { b______,
+ b______,
+ b_OOOO_,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b______ },
+ [0x6f] { b______,
+ b______,
+ b__OOO_,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b__OOO_,
+ b______ },
+ [0x70] { b______,
+ b______,
+ b_OOOO_,
+ b_O___O,
+ b_OOOO_,
+ b_O____,
+ b_O____,
+ b______ },
+ [0x71] { b______,
+ b______,
+ b__OO_O,
+ b_O__OO,
+ b__OOOO,
+ b_____O,
+ b_____O,
+ b______ },
+ [0x72] { b______,
+ b______,
+ b_O_OO_,
+ b_OO__O,
+ b_O____,
+ b_O____,
+ b_O____,
+ b______ },
+ [0x73] { b______,
+ b______,
+ b__OOO_,
+ b_O____,
+ b__OOO_,
+ b_____O,
+ b_OOOO_,
+ b______ },
+ [0x74] { b__O___,
+ b_OOO__,
+ b__O___,
+ b__O___,
+ b__O___,
+ b__O__O,
+ b___OO_,
+ b______ },
+ [0x75] { b______,
+ b______,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O__OO,
+ b__OO_O,
+ b______ },
+ [0x76] { b______,
+ b______,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b__O_O_,
+ b___O__,
+ b______ },
+ [0x77] { b______,
+ b______,
+ b_O___O,
+ b_O___O,
+ b_O___O,
+ b_O_O_O,
+ b__O_O_,
+ b______ },
+ [0x78] { b______,
+ b______,
+ b_O___O,
+ b__O_O_,
+ b___O__,
+ b__O_O_,
+ b_O___O,
+ b______ },
+ [0x79] { b______,
+ b______,
+ b_O___O,
+ b_O___O,
+ b__OOOO,
+ b_____O,
+ b__OOO_,
+ b______ },
+ [0x7a] { b______,
+ b______,
+ b_OOOOO,
+ b____O_,
+ b___O__,
+ b__O___,
+ b_OOOOO,
+ b______ },
+ [0x7b] { b____O_,
+ b___O__,
+ b___O__,
+ b__O___,
+ b___O__,
+ b___O__,
+ b____O_,
+ b______ },
+ [0x7c] { b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b___O__,
+ b______ },
+ [0x7d] { b__O___,
+ b___O__,
+ b___O__,
+ b____O_,
+ b___O__,
+ b___O__,
+ b__O___,
+ b______ },
+ [0x7e] { b______,
+ b___O__,
+ b____O_,
+ b_OOOOO,
+ b____O_,
+ b___O__,
+ b______,
+ b______ },
+
+ [0x7f] { b______,
+ b___O__,
+ b__O___,
+ b_OOOOO,
+ b__O___,
+ b___O__,
+ b______,
+ b______ },
+};
diff --git a/lcd4linux.c b/lcd4linux.c
index cdd0370..b9fd024 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.8 2000/03/22 07:33:50 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.9 2000/03/22 15:36:21 reinelt Exp $
*
* LCD4Linux
*
@@ -20,6 +20,12 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.9 2000/03/22 15:36:21 reinelt
+ *
+ * added '-l' switch (list drivers)
+ * generic pixmap driver added
+ * X11 Framework done
+ *
* Revision 1.8 2000/03/22 07:33:50 reinelt
*
* FAQ added
@@ -67,11 +73,12 @@
#include "display.h"
#include "processor.h"
+char *release="LCD4Linux V" VERSION " (c) 2000 Michael Reinelt <reinelt@eunet.at>";
int tick, tack;
static void usage(void)
{
- printf ("LCD4Linux V" VERSION " (c) 2000 Michael Reinelt <reinelt@eunet.at>\n");
+ printf ("%s\n", release);
printf ("usage: lcd4linux [-h] [-l] [-f config-file]\n");
}
@@ -87,7 +94,8 @@ void main (int argc, char *argv[])
usage();
exit(0);
case 'l':
- usage();
+ printf ("%s\n", release);
+ lcd_list();
exit(0);
case 'f':
cfg=optarg;
@@ -134,7 +142,7 @@ void main (int argc, char *argv[])
process_init();
lcd_clear();
- lcd_put (1, 1, "** LCD4Linux V" VERSION " **");
+ lcd_put (1, 1, "* LCD4Linux V" VERSION " *");
lcd_put (2, 1, " (c) 2000 M.Reinelt");
lcd_flush();
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index 783ea8b..f00c93e 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -1,8 +1,12 @@
-Display LCD2041
-Port /dev/ttyS2
-Speed 19200
-Contrast 160
-
+#Display LCD2041
+#Port /dev/ttyS2
+#Speed 19200
+#Contrast 160
+
+Display X11
+rows 2
+columns 20
+
#Row1 "*** %o %v ***"
#Row2 "%p CPU %r MB RAM"
#Row3 "Busy %cu%% $r10cs+cb"
diff --git a/pixmap.c b/pixmap.c
new file mode 100644
index 0000000..ceaa1f2
--- /dev/null
+++ b/pixmap.c
@@ -0,0 +1,165 @@
+/* $Id: pixmap.c,v 1.1 2000/03/22 15:36:21 reinelt Exp $
+ *
+ * generic pixmap driver
+ *
+ * Copyright 1999, 2000 by Michael Reinelt (reinelt@eunet.at)
+ *
+ * This program 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.
+ *
+ * This program 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: pixmap.c,v $
+ * Revision 1.1 2000/03/22 15:36:21 reinelt
+ *
+ * added '-l' switch (list drivers)
+ * generic pixmap driver added
+ * X11 Framework done
+ *
+ */
+
+/*
+ * exported functions:
+ *
+ * int pix_clear(void);
+ * clears the pixmap
+ *
+ * int pix_init (int r, int c);
+ * allocates & clear pixmap wit r rows and c columns
+ *
+ * int pix_put (int row, int col, char *text);
+ * draws text into the pixmap
+ *
+ * int pix_bar (int type, int row, int col, int max, int len1, int len2);
+ * draws a bar into the pixmap
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "display.h"
+#include "pixmap.h"
+#include "fontmap.h"
+
+static int rows=0;
+static int cols=0;
+unsigned char *Pixmap=NULL;
+
+int pix_clear(void)
+{
+ int i;
+
+ for (i=0; i<rows*cols; i++) {
+ Pixmap[i]=0;
+ }
+
+ return 0;
+}
+
+int pix_init (int r, int c)
+{
+ if (r<1 || c<1)
+ return -1;
+
+ if (Pixmap)
+ free (Pixmap);
+
+ rows=r*YRES;
+ cols=c*XRES;
+
+ if ((Pixmap=malloc (rows*cols*sizeof(unsigned char)))==NULL)
+ return -1;
+
+ return pix_clear();
+}
+
+int pix_put (int row, int col, char *text)
+{
+ int c, x, y, mask;
+
+ row*=YRES;
+ col*=XRES;
+
+ while (*text && col<cols) {
+ c=*text;
+ for (y=0; y<YRES; y++) {
+ mask=1<<XRES;
+ for (x=0; x<XRES; x++) {
+ mask>>=1;
+ Pixmap[(row+y)*cols+col+x]=Fontmap[c][y]&mask?1:0;
+ }
+ }
+ col+=XRES;
+ text++;
+ }
+ return 0;
+}
+
+int pix_bar (int type, int row, int col, int max, int len1, int len2)
+{
+ int i, x, y, len, rev;
+ unsigned char *p;
+
+ row*=YRES;
+ col*=XRES;
+
+ if (type & BAR_H) {
+ if (max>cols-col)
+ max=cols-col;
+ } else {
+ if (max>rows-row)
+ max=rows-row;
+ }
+
+ if (len1<1) len1=1;
+ else if (len1>max) len1=max;
+
+ if (len2<1) len2=1;
+ else if (len2>max) len2=max;
+
+ rev=0;
+
+ switch (type) {
+ case BAR_L:
+ len1=max-len1;
+ len2=max-len2;
+ rev=1;
+
+ case BAR_R:
+ for (y=0; y<YRES; y++) {
+ len=y<YRES/2?len1:len2;
+ for (x=0; x<max; x++) {
+ Pixmap[(row+y)*cols+col+x]=x<len?!rev:rev;
+ }
+ }
+ break;
+
+ case BAR_U:
+ len1=max-len1;
+ len2=max-len2;
+ rev=1;
+
+ case BAR_D:
+ for (y=0; y<max; y++) {
+ for (x=0; x<XRES; x++) {
+ len=x<XRES/2?len1:len2;
+ Pixmap[(row+y)*cols+col+x]=y<len?!rev:rev;
+ }
+ }
+ break;
+
+ }
+ return 0;
+}
+
diff --git a/pixmap.h b/pixmap.h
new file mode 100644
index 0000000..d5c818d
--- /dev/null
+++ b/pixmap.h
@@ -0,0 +1,44 @@
+/* $Id: pixmap.h,v 1.1 2000/03/22 15:36:21 reinelt Exp $
+ *
+ * generic pixmap driver
+ *
+ * Copyright 1999, 2000 by Michael Reinelt (reinelt@eunet.at)
+ *
+ * This program 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.
+ *
+ * This program 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: pixmap.h,v $
+ * Revision 1.1 2000/03/22 15:36:21 reinelt
+ *
+ * added '-l' switch (list drivers)
+ * generic pixmap driver added
+ * X11 Framework done
+ *
+ */
+
+#ifndef _PIXMAP_H_
+#define _PIXMAP_H_
+
+#define XRES 6
+#define YRES 8
+
+extern unsigned char *Pixmap;
+
+int pix_clear(void);
+int pix_init (int r, int c);
+int pix_put (int row, int col, char *text);
+int pix_bar (int type, int row, int col, int max, int len1, int len2);
+
+#endif