aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-10 17:34:40 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-10 17:34:40 +0000
commitcb95898b90081079571dfbff493f9f8611637590 (patch)
tree8ac5cf73fb5b7424c58b47c8906895091ace24f6
parentf223eb72233c076b781c2db7b99af394442a64e6 (diff)
downloadlcd4linux-cb95898b90081079571dfbff493f9f8611637590.tar.gz
[lcd4linux @ 2004-01-10 17:34:40 by reinelt]
further matrixOrbital changes widgets initialized git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@301 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--drv_MatrixOrbital.c230
-rw-r--r--widget.c66
-rw-r--r--widget.h18
3 files changed, 138 insertions, 176 deletions
diff --git a/drv_MatrixOrbital.c b/drv_MatrixOrbital.c
index b537ae7..bb12094 100644
--- a/drv_MatrixOrbital.c
+++ b/drv_MatrixOrbital.c
@@ -1,4 +1,4 @@
-/* $Id: drv_MatrixOrbital.c,v 1.2 2004/01/10 10:20:22 reinelt Exp $
+/* $Id: drv_MatrixOrbital.c,v 1.3 2004/01/10 17:34:40 reinelt Exp $
*
* new style driver for Matrix Orbital serial display modules
*
@@ -23,6 +23,10 @@
*
*
* $Log: drv_MatrixOrbital.c,v $
+ * Revision 1.3 2004/01/10 17:34:40 reinelt
+ * further matrixOrbital changes
+ * widgets initialized
+ *
* Revision 1.2 2004/01/10 10:20:22 reinelt
* new MatrixOrbital changes
*
@@ -253,6 +257,116 @@ static int drv_MO_clear (int protocol)
return 0;
}
+static void drv_MO_goto (int row, int col)
+{
+ char cmd[5]="\376Gyx";
+ cmd[2]=(char)col+1;
+ cmd[3]=(char)row+1;
+ drv_MO_write(cmd,4);
+}
+
+
+static int drv_MO_put (int row, int col, char *text)
+{
+ char *p=FrameBuffer1+row*COLS+col;
+ char *t=text;
+
+ while (*t && col++<=COLS) {
+ *p++=*t++;
+ }
+ return 0;
+}
+
+
+static int drv_MO_bar (int type, int row, int col, int max, int len1, int len2)
+{
+ return bar_draw (type, row, col, max, len1, len2);
+}
+
+
+static int drv_MO_icon (int num, int seq, int row, int col)
+{
+ return icon_draw (num, seq, row, col);
+}
+
+
+static int drv_MO_gpo (int num, int val)
+{
+ if (num>=GPOS)
+ return -1;
+
+ GPO[num]=val;
+
+ // Fixme
+ GPO[num]=255;
+
+ return 0;
+}
+
+
+static int drv_MO_flush (int protocol)
+{
+ int row, col, pos1, pos2;
+ int c, equal;
+ int gpo;
+
+ bar_process(drv_MO_define_char);
+
+ for (row=0; row<ROWS; row++) {
+ for (col=0; col<COLS; col++) {
+ c=bar_peek(row, col);
+ if (c==-1) c=icon_peek(row, col);
+ if (c!=-1) {
+ FrameBuffer1[row*COLS+col]=(char)c;
+ }
+ }
+ for (col=0; col<COLS; col++) {
+ if (FrameBuffer1[row*COLS+col]==FrameBuffer2[row*COLS+col]) continue;
+ drv_MO_goto (row, col);
+ for (pos1=col++, pos2=pos1, equal=0; col<COLS; col++) {
+ if (FrameBuffer1[row*COLS+col]==FrameBuffer2[row*COLS+col]) {
+ // If we find just one equal byte, we don't break, because this
+ // would require a goto, which takes one byte, too.
+ if (++equal>5) break;
+ } else {
+ pos2=col;
+ equal=0;
+ }
+ }
+ drv_MO_write (FrameBuffer1+row*COLS+pos1, pos2-pos1+1);
+ }
+ }
+
+ memcpy (FrameBuffer2, FrameBuffer1, ROWS*COLS*sizeof(char));
+
+ switch (protocol) {
+ case 1:
+ if (GPO[0]) {
+ drv_MO_write ("\376W", 2); // GPO on
+ } else {
+ drv_MO_write ("\376V", 2); // GPO off
+ }
+ break;
+ case 2:
+ for (gpo=1; gpo<=GPOS; gpo++) {
+ char cmd[3]="\376";
+ cmd[1]=GPO[gpo]? 'W':'V';
+ cmd[2]=(char)gpo;
+ drv_MO_write (cmd, 3);
+ }
+ break;
+ }
+
+ return 0;
+}
+
+
+
+// ****************************************
+// *** plugins ***
+// ****************************************
+
+
static void plugin_contrast (RESULT *result, RESULT *arg1)
{
char buffer[4];
@@ -388,115 +502,13 @@ static void plugin_rpm (RESULT *result, RESULT *arg1)
}
-static void drv_MO_goto (int row, int col)
-{
- char cmd[5]="\376Gyx";
- cmd[2]=(char)col+1;
- cmd[3]=(char)row+1;
- drv_MO_write(cmd,4);
-}
-
-
-static int drv_MO_put (int row, int col, char *text)
-{
- char *p=FrameBuffer1+row*COLS+col;
- char *t=text;
-
- while (*t && col++<=COLS) {
- *p++=*t++;
- }
- return 0;
-}
-
-
-static int drv_MO_bar (int type, int row, int col, int max, int len1, int len2)
-{
- return bar_draw (type, row, col, max, len1, len2);
-}
-
-
-static int drv_MO_icon (int num, int seq, int row, int col)
-{
- return icon_draw (num, seq, row, col);
-}
-
-
-static int drv_MO_gpo (int num, int val)
-{
- if (num>=GPOS)
- return -1;
-
- GPO[num]=val;
-
- // Fixme
- GPO[num]=255;
-
- return 0;
-}
-
-
-static int drv_MO_flush (int protocol)
-{
- int row, col, pos1, pos2;
- int c, equal;
- int gpo;
-
- bar_process(drv_MO_define_char);
-
- for (row=0; row<ROWS; row++) {
- for (col=0; col<COLS; col++) {
- c=bar_peek(row, col);
- if (c==-1) c=icon_peek(row, col);
- if (c!=-1) {
- FrameBuffer1[row*COLS+col]=(char)c;
- }
- }
- for (col=0; col<COLS; col++) {
- if (FrameBuffer1[row*COLS+col]==FrameBuffer2[row*COLS+col]) continue;
- drv_MO_goto (row, col);
- for (pos1=col++, pos2=pos1, equal=0; col<COLS; col++) {
- if (FrameBuffer1[row*COLS+col]==FrameBuffer2[row*COLS+col]) {
- // If we find just one equal byte, we don't break, because this
- // would require a goto, which takes one byte, too.
- if (++equal>5) break;
- } else {
- pos2=col;
- equal=0;
- }
- }
- drv_MO_write (FrameBuffer1+row*COLS+pos1, pos2-pos1+1);
- }
- }
-
- memcpy (FrameBuffer2, FrameBuffer1, ROWS*COLS*sizeof(char));
-
- switch (protocol) {
- case 1:
- if (GPO[0]) {
- drv_MO_write ("\376W", 2); // GPO on
- } else {
- drv_MO_write ("\376V", 2); // GPO off
- }
- break;
- case 2:
- for (gpo=1; gpo<=GPOS; gpo++) {
- char cmd[3]="\376";
- cmd[1]=GPO[gpo]? 'W':'V';
- cmd[2]=(char)gpo;
- drv_MO_write (cmd, 3);
- }
- break;
- }
-
- return 0;
-}
-
-// *****************************
-// exported functions start here
-// *****************************
+// ****************************************
+// *** exported functions ***
+// ****************************************
+// list models
int drv_MO_list (void)
{
int i;
@@ -508,6 +520,7 @@ int drv_MO_list (void)
}
+// initialize driver & display
int drv_MO_init (char *section)
{
int i;
@@ -630,7 +643,7 @@ int drv_MO_init (char *section)
drv_MO_write ("\376D", 2); // line wrapping off
drv_MO_write ("\376R", 2); // auto scroll off
- // register as a plugin
+ // register plugins
AddFunction ("contrast", 1, plugin_contrast);
AddFunction ("backlight", 1, plugin_backlight);
AddFunction ("gpo", 2, plugin_gpo);
@@ -641,6 +654,7 @@ int drv_MO_init (char *section)
}
+// close driver & display
int drv_MO_quit (void) {
info("MatrixOrbital: shutting down.");
diff --git a/widget.c b/widget.c
index ccfa46c..d2bb73d 100644
--- a/widget.c
+++ b/widget.c
@@ -1,8 +1,9 @@
-/* $Id: widget.c,v 1.2 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: widget.c,v 1.3 2004/01/10 17:34:40 reinelt Exp $
*
* generic widget handling
*
- * Copyright 2003 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2003,2004 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
*
* 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
@@ -20,6 +21,10 @@
*
*
* $Log: widget.c,v $
+ * Revision 1.3 2004/01/10 17:34:40 reinelt
+ * further matrixOrbital changes
+ * widgets initialized
+ *
* Revision 1.2 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
@@ -45,61 +50,6 @@
#include "cfg.h"
#include "widget.h"
-static int ROWS=0;
-static int COLS=0;
-static int XRES=0;
-static int YRES=0;
-
-static int *Screen=NULL;
-static WIDGET *Widget=NULL;
-static int nWidget=0;
-
-
-int widget_init (int rows, int cols, int xres, int yres)
-{
- if (rows<1 || cols<1)
- return -1;
-
- ROWS=rows;
- COLS=cols;
- XRES=xres;
- YRES=yres;
-
- if ((Screen=malloc(ROWS*COLS*sizeof(*Screen)))==NULL) {
- error ("widget buffer allocation failed: out of memory?");
- return -1;
- }
-
- nWidget=0;
- Widget=NULL;
-return 0;
-}
-
-
-void widget_clear (void)
-{
- int n;
-
- for (n=0; n<ROWS*COLS; n++) {
- Screen[n]=-1;
- }
-
-}
-
-
-int widget_add ()
-{
- nWidget++;
- Widget=realloc(Widget, nWidget*sizeof(*Widget));
-
- return 0;
-}
-
-
-int widget_peek (int row, int col)
+int widget_register (void)
{
- if (Screen)
- return Screen[row*COLS+col];
- else
- return -1;
}
diff --git a/widget.h b/widget.h
index d487826..05999e6 100644
--- a/widget.h
+++ b/widget.h
@@ -1,8 +1,9 @@
-/* $Id: widget.h,v 1.2 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: widget.h,v 1.3 2004/01/10 17:34:40 reinelt Exp $
*
* generic widget handling
*
- * Copyright 2003 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2003,2004 Michael Reinelt <reinelt@eunet.at>
+ * Copyright 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
*
* This file is part of LCD4Linux.
*
@@ -22,6 +23,10 @@
*
*
* $Log: widget.h,v $
+ * Revision 1.3 2004/01/10 17:34:40 reinelt
+ * further matrixOrbital changes
+ * widgets initialized
+ *
* Revision 1.2 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
@@ -34,13 +39,6 @@
#ifndef _WIDGET_H_
#define _WIDGET_H_
-typedef struct widget {
- int x, y;
- int w, h;
-
-} WIDGET;
-
-int widget_init (int rows, int cols, int xres, int yres);
-void widget_clear(void);
+int widget_register (void);
#endif