]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2003-09-10 03:48:22 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 10 Sep 2003 03:48:23 +0000 (03:48 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 10 Sep 2003 03:48:23 +0000 (03:48 +0000)
Icons for M50530, new processing scheme (Ticks.Text...)

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

HD44780.c
M50530.c
MatrixOrbital.c
USBLCD.c
display.c
icon.c
processor.c

index 245e2ca320cc1b271db5f9c502263a375af2f345..1db6df27065379e9e0586e08d5e0d23cf317601d 100644 (file)
--- a/HD44780.c
+++ b/HD44780.c
@@ -1,4 +1,4 @@
-/* $Id: HD44780.c,v 1.38 2003/09/09 11:47:47 reinelt Exp $
+/* $Id: HD44780.c,v 1.39 2003/09/10 03:48:22 reinelt Exp $
  *
  * driver for display modules based on the HD44780 chip
  *
@@ -27,6 +27,9 @@
  *
  *
  * $Log: HD44780.c,v $
+ * Revision 1.39  2003/09/10 03:48:22  reinelt
+ * Icons for M50530, new processing scheme (Ticks.Text...)
+ *
  * Revision 1.38  2003/09/09 11:47:47  reinelt
  * basic icon support for HD44780
  *
@@ -499,7 +502,7 @@ int HD_init (LCD *Self)
   HD_command (0x03, 0x0c, 1640); // Display on, cursor off, blink off, wait 1.64 ms
   HD_command (0x03, 0x06, 40);   // curser moves to right, no shift
 
-  if (cfg_number("Icons", 0, 0, 8, &Icons)<0) return -1;
+  if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
   if (Icons>0) {
     info ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
     icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, HD_define_char);
index 0fa506d150d1c48b4fc2f284372e330feee6a1f5..f43d9e2b3cf5fd1535707bd803a14f9b36061484 100644 (file)
--- a/M50530.c
+++ b/M50530.c
@@ -1,4 +1,4 @@
-/* $Id: M50530.c,v 1.13 2003/09/09 06:54:43 reinelt Exp $
+/* $Id: M50530.c,v 1.14 2003/09/10 03:48:22 reinelt Exp $
  *
  * driver for display modules based on the M50530 chip
  *
@@ -20,6 +20,9 @@
  *
  *
  * $Log: M50530.c,v $
+ * Revision 1.14  2003/09/10 03:48:22  reinelt
+ * Icons for M50530, new processing scheme (Ticks.Text...)
+ *
  * Revision 1.13  2003/09/09 06:54:43  reinelt
  * new function 'cfg_number()'
  *
@@ -82,6 +85,7 @@
 #include "cfg.h"
 #include "display.h"
 #include "bar.h"
+#include "icon.h"
 #include "parport.h"
 #include "udelay.h"
 
@@ -90,7 +94,8 @@
 #define CHARS 8
 
 static LCD Lcd;
-static int  GPO=0;
+static int GPO=0;
+static int Icons;
 
 static char *FrameBuffer1=NULL;
 static char *FrameBuffer2=NULL;
@@ -166,7 +171,10 @@ int M5_clear (int full)
 {
 
   memset (FrameBuffer1, ' ', Lcd.rows*Lcd.cols*sizeof(char));
+
+  icon_clear();
   bar_clear();
+
   GPO=0;
 
   if (full) {
@@ -228,7 +236,15 @@ int M5_init (LCD *Self)
   M5_command (0x0050, 20); // set entry mode
   M5_command (0x0030, 20); // set display mode
   
-  bar_init(rows, cols, XRES, YRES, CHARS);
+  if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
+  if (Icons>0) {
+    info ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
+    icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, M5_define_char);
+    Self->icons=Icons;
+    Lcd.icons=Icons;
+  }
+  
+  bar_init(rows, cols, XRES, YRES, CHARS-Icons);
   bar_add_segment(0,0,255,32); // ASCII 32 = blank
   
   M5_clear(1);
@@ -265,6 +281,12 @@ int M5_bar (int type, int row, int col, int max, int len1, int len2)
 }
 
 
+int M5_icon (int num, int seq, int row, int col)
+{
+  return icon_draw (num, seq, row, col);
+}
+
+
 int M5_gpo (int num, int val)
 {
   if (num>=Lcd.gpos) 
@@ -289,6 +311,7 @@ int M5_flush (void)
   for (row=0; row<Lcd.rows; row++) {
     for (col=0; col<Lcd.cols; col++) {
       c=bar_peek(row, col);
+      if (c==-1) c=icon_peek(row, col);
       if (c!=-1) {
        if (c!=32) c+=248; //blank
        FrameBuffer1[row*Lcd.cols+col]=(char)c;
@@ -344,11 +367,13 @@ LCD M50530[] = {
     xres:  XRES,
     yres:  YRES,
     bars:  BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2,
+    icons: 0,
     gpos:  0,
     init:  M5_init,
     clear: M5_clear,
     put:   M5_put,
     bar:   M5_bar,
+    icon:  M5_icon,
     gpo:   M5_gpo,
     flush: M5_flush,
     quit:  M5_quit 
index 74cb3f742d95a32afa6612b284df9cfb0dfef596..bf0c48f92c02c6da012b2c0c1adde6aef4f87e93 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: MatrixOrbital.c,v 1.38 2003/09/09 11:47:47 reinelt Exp $
+/* $Id: MatrixOrbital.c,v 1.39 2003/09/10 03:48:23 reinelt Exp $
  *
  * driver for Matrix Orbital serial display modules
  *
@@ -20,6 +20,9 @@
  *
  *
  * $Log: MatrixOrbital.c,v $
+ * Revision 1.39  2003/09/10 03:48:23  reinelt
+ * Icons for M50530, new processing scheme (Ticks.Text...)
+ *
  * Revision 1.38  2003/09/09 11:47:47  reinelt
  * basic icon support for HD44780
  *
@@ -371,7 +374,7 @@ static int MO_init (LCD *Self, int protocol)
   Device=MO_open();
   if (Device==-1) return -1;
 
-  if (cfg_number("Icons", 0, 0, 8, &Icons)<0) return -1;
+  if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
   if (Icons>0) {
     info ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
     icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, MO_define_char);
index 60c689f06676778cd404ee739b4a8a437835dda1..55917c4b213c12b3f871ea8e36b670e8460d020a 100644 (file)
--- a/USBLCD.c
+++ b/USBLCD.c
@@ -1,4 +1,4 @@
-/* $Id: USBLCD.c,v 1.15 2003/09/09 11:47:47 reinelt Exp $
+/* $Id: USBLCD.c,v 1.16 2003/09/10 03:48:23 reinelt Exp $
  *
  * Driver for USBLCD ( see http://www.usblcd.de )
  * This Driver is based on HD44780.c
@@ -22,6 +22,9 @@
  *
  *
  * $Log: USBLCD.c,v $
+ * Revision 1.16  2003/09/10 03:48:23  reinelt
+ * Icons for M50530, new processing scheme (Ticks.Text...)
+ *
  * Revision 1.15  2003/09/09 11:47:47  reinelt
  * basic icon support for HD44780
  *
@@ -281,7 +284,7 @@ int USBLCD_init (LCD *Self)
   if (USBLCD_open()!=0)
     return -1;
   
-  if (cfg_number("Icons", 0, 0, 8, &Icons)<0) return -1;
+  if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1;
   if (Icons>0) {
     info ("reserving %d of %d user-defined characters for icons", Icons, CHARS);
     icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, USBLCD_define_char);
index ecc58a50ff927b2c70a2dc4f0c5c48d41000680e..11b5530f8b04ed4ee3bbd022dc95b0d8655fd1d9 100644 (file)
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.41 2003/09/09 05:30:34 reinelt Exp $
+/* $Id: display.c,v 1.42 2003/09/10 03:48:23 reinelt Exp $
  *
  * framework for device drivers
  *
@@ -20,6 +20,9 @@
  *
  *
  * $Log: display.c,v $
+ * Revision 1.42  2003/09/10 03:48:23  reinelt
+ * Icons for M50530, new processing scheme (Ticks.Text...)
+ *
  * Revision 1.41  2003/09/09 05:30:34  reinelt
  * even more icons stuff
  *
@@ -382,9 +385,8 @@ int lcd_icon (int num, int seq, int row, int col)
 {
   if (Lcd->icon==NULL)         return  0;
   if (num<1 || num>Lcd->icons) return -1;
-  if (seq<1)                   return -1;
-  if (row<1 || row>Lcd->rows)  return -1;
-  if (col<1 || col>Lcd->cols)  return -1;
+  if (         row>Lcd->rows)  return -1;
+  if (         col>Lcd->cols)  return -1;
   return Lcd->icon(num-1, seq-1, row-1, col-1);
 }
 
diff --git a/icon.c b/icon.c
index 12e5a226540a1dbbc52263e9ab3fef60e9e6fcb7..cbc48be0427c49061eb3425c9dcb3ee4b40c1d3a 100644 (file)
--- a/icon.c
+++ b/icon.c
@@ -1,4 +1,4 @@
-/* $Id: icon.c,v 1.4 2003/09/09 05:30:34 reinelt Exp $
+/* $Id: icon.c,v 1.5 2003/09/10 03:48:23 reinelt Exp $
  *
  * generic icon and heartbeat handling
  *
@@ -20,6 +20,9 @@
  *
  *
  * $Log: icon.c,v $
+ * Revision 1.5  2003/09/10 03:48:23  reinelt
+ * Icons for M50530, new processing scheme (Ticks.Text...)
+ *
  * Revision 1.4  2003/09/09 05:30:34  reinelt
  * even more icons stuff
  *
@@ -183,22 +186,19 @@ void icon_clear(void)
 
 int icon_draw (int num, int seq, int row, int col)
 {
-  if (num>=ICONS) return -1;
-  if (row>=ROWS)  return -1;
-  if (col>=COLS)  return -1;
-
-  seq%=Bitmap[num].nData;
-  if (seq!=Bitmap[num].lData) {
-    Bitmap[num].lData=seq;
-    Defchar (CHARS-num-1, Bitmap[num].Data+seq*YRES);
+  if (seq>=0) {
+    seq%=Bitmap[num].nData;
+    if (seq!=Bitmap[num].lData) {
+      Bitmap[num].lData=seq;
+      Defchar (CHARS-num-1, Bitmap[num].Data+seq*YRES);
+    }
   }
   
-  // just redefine icon?
-  if (row<0 || col<0) return 0;
+  if (row>=0 && col>=0) {
+    // icons use last ascii codes from userdef chars
+    Screen[row*COLS+col]=CHARS-num-1;
+  }
   
-  // icons use last ascii codes from userdef chars
-  Screen[row*COLS+col]=CHARS-num-1;
-
   return 0;
 }
 
index 481c4eb29cc99fc13d18825f4819d667d19e51d2..d3f5f35e3a5014c008ea1ffbc3c559411d38a579 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: processor.c,v 1.40 2003/09/09 06:54:43 reinelt Exp $
+/* $Id: processor.c,v 1.41 2003/09/10 03:48:23 reinelt Exp $
  *
  * main data processing
  *
@@ -20,6 +20,9 @@
  *
  *
  * $Log: processor.c,v $
+ * Revision 1.41  2003/09/10 03:48:23  reinelt
+ * Icons for M50530, new processing scheme (Ticks.Text...)
+ *
  * Revision 1.40  2003/09/09 06:54:43  reinelt
  * new function 'cfg_number()'
  *
 static char *row[ROWS+1];
 static int   gpo[GPOS+1];
 static int   rows, cols, xres, yres, supported_bars, icons, gpos;
+static int   tick_txt, tick_bar, tick_icn, tick_gpo;
 static int   lines, scroll, turn;
 static int   token_usage[256]={0,};
 
@@ -690,7 +694,7 @@ static char *process_row (char *data, int row, int len)
       }
       
     } else if (*s=='&') {
-      lcd_icon(*(++s)-'0', 1, row, p-buffer+1);
+      lcd_icon(*(++s)-'0', 0, row, p-buffer+1);
       *p++=' ';
       
     } else {
@@ -801,6 +805,23 @@ void process_init (void)
   }
 
 
+  if (cfg_number("Ticks.Text", 5, 1, 1000, &tick_txt)<0) {
+    tick_txt=5;
+    error ("ignoring bad 'Ticks.Text' value and using '%d'", tick_txt);
+  }
+  if (cfg_number("Ticks.Bar", 1, 1, 1000, &tick_bar)<0) {
+    tick_bar=1;
+    error ("ignoring bad 'Ticks.Bar' value and using '%d'", tick_bar);
+  }
+  if (cfg_number("Ticks.Icon", 1, 1, 1000, &tick_icn)<0) {
+    tick_icn=1;
+    error ("ignoring bad 'Ticks.Icon' value and using '%d'", tick_icn);
+  }
+  if (cfg_number("Ticks.GPO", 1, 1, 1000, &tick_gpo)<0) {
+    tick_gpo=1;
+    error ("ignoring bad 'Ticks.GPO' value and using '%d'", tick_gpo);
+  }
+
   for (i=1; i<=lines; i++) {
     char buffer[8], *p;
     snprintf (buffer, sizeof(buffer), "Row%d", i);
@@ -817,21 +838,43 @@ void process_init (void)
     debug ("%s: %s", buffer, p);
     gpo[i]=parse_gpo(p, token_usage);
   }
+
 }
 
 
 void process (void)
 {
+  static int loop_txt=-1;
+  static int loop_bar=-1;
+  static int loop_icn=-1;
+  static int loop_gpo=-1;
+  static int offset=0;
+
   int i, j, val;
   char *txt;
-  static int offset=0;
   
-  // Fixme: smooth has gone...
-  int smooth=0;
+  // Fixme:
+  static int junk=0;
+  
+  if (++loop_txt > tick_txt) loop_txt=0;
+  if (++loop_bar > tick_bar) loop_bar=0;
+  if (++loop_icn > tick_icn) loop_icn=0;
+  if (++loop_gpo > tick_gpo) loop_gpo=0;
+
+  // update icon animations
+  if (loop_icn==0) {
+    lcd_icon (1, ++junk, 0, 0);
+  }
+  
+  // is there anything to process?
+  if (loop_txt>0 && loop_bar>0 && loop_gpo>0) {
+    // no, there isn't :-)
+    return;
+  }
   
   collect_data();
-
-  if (smooth==0 && Turn()) {
+  
+  if (Turn() && loop_txt==0) {
     offset+=scroll;
     while (offset>=lines) {
       offset-=lines;
@@ -839,21 +882,25 @@ void process (void)
     lcd_clear(0); // soft clear
   }
   
-  for (i=1; i<=rows; i++) {
-    j=i+offset;
-    while (j>lines) {
-      j-=lines;
+  if (loop_txt==0 || loop_bar==0) {
+    for (i=1; i<=rows; i++) {
+      j=i+offset;
+      while (j>lines) {
+       j-=lines;
+      }
+      txt=process_row (row[j], i, cols);
+      if (loop_txt==0)
+       lcd_put (i, 1, txt);
     }
-    txt=process_row (row[j], i, cols);
-    if (smooth==0)
-      lcd_put (i, 1, txt);
   }
-
-  for (i=1; i<=gpos; i++) {
-    val=process_gpo (i);
-    lcd_gpo (i, val);
+  
+  if (loop_gpo==0) {
+    for (i=1; i<=gpos; i++) {
+      val=process_gpo (i);
+      lcd_gpo (i, val);
+    }
   }
-
+  
   lcd_flush();
-
+  
 }