aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-09-10 03:48:23 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-09-10 03:48:23 +0000
commit525c17277ccccf4459be16018576b44e9e6a2a35 (patch)
tree8f61bced69808fea15902d45c7fe35f3625c1d9a
parentef5ef770de8b4b5d682d24efff30c6cc084d8cc4 (diff)
downloadlcd4linux-525c17277ccccf4459be16018576b44e9e6a2a35.tar.gz
[lcd4linux @ 2003-09-10 03:48:22 by reinelt]
Icons for M50530, new processing scheme (Ticks.Text...) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@235 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--HD44780.c7
-rw-r--r--M50530.c31
-rw-r--r--MatrixOrbital.c7
-rw-r--r--USBLCD.c7
-rw-r--r--display.c10
-rw-r--r--icon.c28
-rw-r--r--processor.c87
7 files changed, 130 insertions, 47 deletions
diff --git a/HD44780.c b/HD44780.c
index 245e2ca..1db6df2 100644
--- 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);
diff --git a/M50530.c b/M50530.c
index 0fa506d..f43d9e2 100644
--- 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
diff --git a/MatrixOrbital.c b/MatrixOrbital.c
index 74cb3f7..bf0c48f 100644
--- a/MatrixOrbital.c
+++ b/MatrixOrbital.c
@@ -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);
diff --git a/USBLCD.c b/USBLCD.c
index 60c689f..55917c4 100644
--- 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);
diff --git a/display.c b/display.c
index ecc58a5..11b5530 100644
--- 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 12e5a22..cbc48be 100644
--- 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;
}
diff --git a/processor.c b/processor.c
index 481c4eb..d3f5f35 100644
--- a/processor.c
+++ b/processor.c
@@ -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()'
*
@@ -213,6 +216,7 @@
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();
-
+
}