aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-08-17 16:37:39 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-08-17 16:37:39 +0000
commit946a5ef8dd7de4c8900dc52d5597b6ded3764394 (patch)
treef9151a571b5eb5cffde7b9fde4bb64ff6002f814
parenta7a01e3ffef0fdb4c3bb51afb2928c3f6828ccc9 (diff)
downloadlcd4linux-946a5ef8dd7de4c8900dc52d5597b6ded3764394.tar.gz
[lcd4linux @ 2003-08-17 16:37:39 by reinelt]
more icon framework git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@222 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--MatrixOrbital.c50
-rw-r--r--display.c20
-rw-r--r--display.h7
-rw-r--r--lcd4linux.c7
-rw-r--r--processor.c16
5 files changed, 77 insertions, 23 deletions
diff --git a/MatrixOrbital.c b/MatrixOrbital.c
index 7cd32f1..a900b27 100644
--- a/MatrixOrbital.c
+++ b/MatrixOrbital.c
@@ -1,4 +1,4 @@
-/* $Id: MatrixOrbital.c,v 1.29 2003/08/16 07:31:35 reinelt Exp $
+/* $Id: MatrixOrbital.c,v 1.30 2003/08/17 16:37:39 reinelt Exp $
*
* driver for Matrix Orbital serial display modules
*
@@ -20,6 +20,9 @@
*
*
* $Log: MatrixOrbital.c,v $
+ * Revision 1.30 2003/08/17 16:37:39 reinelt
+ * more icon framework
+ *
* Revision 1.29 2003/08/16 07:31:35 reinelt
* double buffering in all drivers
*
@@ -173,6 +176,7 @@ static LCD Lcd;
static char *Port=NULL;
static speed_t Speed;
static int Device=-1;
+static int Icons;
static int GPO;
static char *FrameBuffer1=NULL;
@@ -292,7 +296,7 @@ int MO_clear2 (int full)
static int MO_init (LCD *Self, int protocol)
{
char *port;
- char *speed;
+ char *s, *e;
Lcd=*Self;
@@ -316,9 +320,9 @@ static int MO_init (LCD *Self, int protocol)
}
Port=strdup(port);
- speed=cfg_get("Speed","19200");
+ s=cfg_get("Speed","19200");
- switch (atoi(speed)) {
+ switch (atoi(s)) {
case 1200:
Speed=B1200;
break;
@@ -332,16 +336,27 @@ static int MO_init (LCD *Self, int protocol)
Speed=B19200;
break;
default:
- error ("MatrixOrbital: unsupported speed '%s' in %s", speed, cfg_file());
+ error ("MatrixOrbital: unsupported speed '%s' in %s", s, cfg_file());
return -1;
}
- debug ("using port %s at %d baud", Port, atoi(speed));
+ debug ("using port %s at %d baud", Port, atoi(s));
Device=MO_open();
if (Device==-1) return -1;
- bar_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS);
+ s=cfg_get("Icons", "0");
+ if ((Icons=strtol(s, &e, 0))==0 || *e!='\0' || (Icons<0 && Icons>8)) {
+ error ("MatrixOrbital: bad Iconss '%s' in %s, must be between 0 and 8", s, cfg_file());
+ return -1;
+ }
+ if (Icons>0) {
+ info ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
+ Self->icons=Icons;
+ Lcd.icons=Icons;
+ }
+
+ bar_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS-Icons);
bar_add_segment( 0, 0,255, 32); // ASCII 32 = blank
bar_add_segment(255,255,255,255); // ASCII 255 = block
@@ -395,6 +410,13 @@ int MO_bar (int type, int row, int col, int max, int len1, int len2)
}
+int MO_icon (int num, int row, int col, unsigned char *bitmap)
+{
+ // Fixme: ToDo!!
+ return 0;
+}
+
+
int MO_gpo (int num, int val)
{
if (num>=Lcd.gpos)
@@ -504,11 +526,13 @@ LCD MatrixOrbital[] = {
xres: XRES,
yres: YRES,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
+ icons: 0,
gpos: 1,
init: MO_init1,
clear: MO_clear1,
put: MO_put,
bar: MO_bar,
+ icon: MO_icon,
gpo: MO_gpo,
flush: MO_flush1,
quit: MO_quit
@@ -519,11 +543,13 @@ LCD MatrixOrbital[] = {
xres: XRES,
yres: YRES,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
+ icons: 0,
gpos: 1,
init: MO_init1,
clear: MO_clear1,
put: MO_put,
bar: MO_bar,
+ icon: MO_icon,
gpo: MO_gpo,
flush: MO_flush1,
quit: MO_quit
@@ -534,11 +560,13 @@ LCD MatrixOrbital[] = {
xres: XRES,
yres: YRES,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
+ icons: 0,
gpos: 1,
init: MO_init1,
clear: MO_clear1,
put: MO_put,
bar: MO_bar,
+ icon: MO_icon,
gpo: MO_gpo,
flush: MO_flush1,
quit: MO_quit
@@ -549,11 +577,13 @@ LCD MatrixOrbital[] = {
xres: XRES,
yres: YRES,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
+ icons: 0,
gpos: 1,
init: MO_init1,
clear: MO_clear1,
put: MO_put,
bar: MO_bar,
+ icon: MO_icon,
gpo: MO_gpo,
flush: MO_flush1,
quit: MO_quit
@@ -564,11 +594,13 @@ LCD MatrixOrbital[] = {
xres: XRES,
yres: YRES,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
+ icons: 0,
gpos: 1,
init: MO_init1,
clear: MO_clear1,
put: MO_put,
bar: MO_bar,
+ icon: MO_icon,
gpo: MO_gpo,
flush: MO_flush1,
quit: MO_quit
@@ -579,11 +611,13 @@ LCD MatrixOrbital[] = {
xres: XRES,
yres: YRES,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
+ icons: 0,
gpos: 6,
init: MO_init2,
clear: MO_clear2,
put: MO_put,
bar: MO_bar,
+ icon: MO_icon,
gpo: MO_gpo,
flush: MO_flush2,
quit: MO_quit
@@ -594,11 +628,13 @@ LCD MatrixOrbital[] = {
xres: XRES,
yres: YRES,
bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
+ icons: 0,
gpos: 6,
init: MO_init2,
clear: MO_clear2,
put: MO_put,
bar: MO_bar,
+ icon: MO_icon,
gpo: MO_gpo,
flush: MO_flush2,
quit: MO_quit
diff --git a/display.c b/display.c
index 038dcf4..84c7ae5 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.36 2003/08/17 12:11:58 reinelt Exp $
+/* $Id: display.c,v 1.37 2003/08/17 16:37:39 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,9 @@
*
*
* $Log: display.c,v $
+ * Revision 1.37 2003/08/17 16:37:39 reinelt
+ * more icon framework
+ *
* Revision 1.36 2003/08/17 12:11:58 reinelt
* framework for icons prepared
*
@@ -305,17 +308,18 @@ int lcd_init (char *driver)
return -1;
}
-int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *gpos)
+int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *icons, int *gpos)
{
if (Lcd==NULL)
return -1;
- if (rows) *rows=Lcd->rows;
- if (cols) *cols=Lcd->cols;
- if (xres) *xres=Lcd->xres;
- if (yres) *yres=Lcd->yres;
- if (bars) *bars=Lcd->bars;
- if (gpos) *gpos=Lcd->gpos;
+ if (rows) *rows=Lcd->rows;
+ if (cols) *cols=Lcd->cols;
+ if (xres) *xres=Lcd->xres;
+ if (yres) *yres=Lcd->yres;
+ if (bars) *bars=Lcd->bars;
+ if (icons) *icons=Lcd->icons;
+ if (gpos) *gpos=Lcd->gpos;
return 0;
}
diff --git a/display.h b/display.h
index 68087ea..fa0ddae 100644
--- a/display.h
+++ b/display.h
@@ -1,4 +1,4 @@
-/* $Id: display.h,v 1.17 2003/08/17 12:11:58 reinelt Exp $
+/* $Id: display.h,v 1.18 2003/08/17 16:37:39 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,9 @@
*
*
* $Log: display.h,v $
+ * Revision 1.18 2003/08/17 16:37:39 reinelt
+ * more icon framework
+ *
* Revision 1.17 2003/08/17 12:11:58 reinelt
* framework for icons prepared
*
@@ -119,7 +122,7 @@ typedef struct {
int lcd_list (void);
int lcd_init (char *driver);
-int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *gpos);
+int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *icons, int *gpos);
int lcd_clear (int full);
int lcd_put (int row, int col, char *text);
int lcd_bar (int type, int row, int col, int max, int len1, int le2);
diff --git a/lcd4linux.c b/lcd4linux.c
index ee44cb5..91f42a9 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.42 2003/08/14 03:47:40 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.43 2003/08/17 16:37:39 reinelt Exp $
*
* LCD4Linux
*
@@ -20,6 +20,9 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.43 2003/08/17 16:37:39 reinelt
+ * more icon framework
+ *
* Revision 1.42 2003/08/14 03:47:40 reinelt
* remove PID file if driver initialisation fails
*
@@ -263,7 +266,7 @@ int hello (void)
"(c) M.Reinelt",
NULL };
- lcd_query (&y, &x, NULL, NULL, NULL, NULL);
+ lcd_query (&y, &x, NULL, NULL, NULL, NULL, NULL);
flag=0;
for (i=0; line1[i]; i++) {
diff --git a/processor.c b/processor.c
index a70c798..ca3f91e 100644
--- a/processor.c
+++ b/processor.c
@@ -1,4 +1,4 @@
-/* $Id: processor.c,v 1.35 2003/07/24 04:48:09 reinelt Exp $
+/* $Id: processor.c,v 1.36 2003/08/17 16:37:39 reinelt Exp $
*
* main data processing
*
@@ -20,6 +20,9 @@
*
*
* $Log: processor.c,v $
+ * Revision 1.36 2003/08/17 16:37:39 reinelt
+ * more icon framework
+ *
* Revision 1.35 2003/07/24 04:48:09 reinelt
* 'soft clear' needed for virtual rows
*
@@ -193,11 +196,12 @@
#include "exec.h"
#define ROWS 64
+#define ICONS 8
#define GPOS 16
static char *row[ROWS+1];
static int gpo[GPOS+1];
-static int rows, cols, xres, yres, supported_bars, gpos;
+static int rows, cols, xres, yres, supported_bars, icons, gpos;
static int lines, scroll, turn;
static int token_usage[256]={0,};
@@ -729,16 +733,20 @@ void process_init (void)
load.overload=atof(cfg_get("overload","2.0"));
- lcd_query (&rows, &cols, &xres, &yres, &supported_bars, &gpos);
+ lcd_query (&rows, &cols, &xres, &yres, &supported_bars, &icons, &gpos);
if (rows>ROWS) {
error ("%d rows exceeds limit, reducing to %d rows", rows, ROWS);
rows=ROWS;
}
+ if (icons>ICONS) {
+ error ("%d icons exceeds limit, reducing to %d icons", icons, ICONS);
+ icons=ICONS;
+ }
if (gpos>GPOS) {
error ("%d gpos exceeds limit, reducing to %d gpos", gpos, GPOS);
gpos=GPOS;
}
- debug ("Display: %d rows, %d columns, %dx%d pixels, %d GPOs", rows, cols, xres, yres, gpos);
+ debug ("Display: %d rows, %d columns, %dx%d pixels, %d icons, %d GPOs", rows, cols, xres, yres, icons, gpos);
lines=atoi(cfg_get("Rows","1"));