]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2003-08-17 16:37:39 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 17 Aug 2003 16:37:39 +0000 (16:37 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 17 Aug 2003 16:37:39 +0000 (16:37 +0000)
more icon framework

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@222 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

MatrixOrbital.c
display.c
display.h
lcd4linux.c
processor.c

index 7cd32f1a33981927965d340b7748d965a6842a4a..a900b27c0f2452dfdcf6f912895c74836fea9617 100644 (file)
@@ -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 
index 038dcf47ec834c7b5eee8161d6ac6a183601f152..84c7ae5501d9a654516761a1e3b8c82a471555db 100644 (file)
--- 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;
 }
index 68087ea8e368f6bec13e8ee53e6b0d0035961830..fa0ddae302d96c859366fae5ffa5e4445012eace 100644 (file)
--- 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);
index ee44cb5c9c33b90f5ae00c514dcbeb18ce4458ef..91f42a9ba41f13f847a5428c6ec5d76841bb1b5a 100644 (file)
@@ -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++) {
index a70c798a8fc519a8e27b69f6e60d3f2878466c9c..ca3f91efc93fc92aa70d8bca48c98023b46f2355 100644 (file)
@@ -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
  *
 #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"));