aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2000-03-26 18:46:28 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2000-03-26 18:46:28 +0000
commitc028ba39da4ad240a79d50ca39e6fc2bf0590e2c (patch)
treed97b388f449ae839224b891f069eb7ca98957b0b
parent1b000d3a15726fce16c2eda57ff51cd1f3886cc9 (diff)
downloadlcd4linux-c028ba39da4ad240a79d50ca39e6fc2bf0590e2c.tar.gz
[lcd4linux @ 2000-03-26 18:46:28 by reinelt]
bug in pixmap.c that leaded to empty bars fixed name conflicts with X11 resolved git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@22 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r--MatrixOrbital.c43
-rw-r--r--README.Drivers10
-rw-r--r--Raster.c31
-rw-r--r--Skeleton.c17
-rw-r--r--XWindow.c31
-rw-r--r--display.c65
-rw-r--r--display.h17
-rw-r--r--lcd4linux.c15
-rw-r--r--lcd4linux.conf.sample18
-rw-r--r--pixmap.c33
10 files changed, 163 insertions, 117 deletions
diff --git a/MatrixOrbital.c b/MatrixOrbital.c
index 1e9a5dc..833c794 100644
--- a/MatrixOrbital.c
+++ b/MatrixOrbital.c
@@ -1,4 +1,4 @@
-/* $Id: MatrixOrbital.c,v 1.11 2000/03/25 05:50:43 reinelt Exp $
+/* $Id: MatrixOrbital.c,v 1.12 2000/03/26 18:46:28 reinelt Exp $
*
* driver for Matrix Orbital serial display modules
*
@@ -20,6 +20,11 @@
*
*
* $Log: MatrixOrbital.c,v $
+ * Revision 1.12 2000/03/26 18:46:28 reinelt
+ *
+ * bug in pixmap.c that leaded to empty bars fixed
+ * name conflicts with X11 resolved
+ *
* Revision 1.11 2000/03/25 05:50:43 reinelt
*
* memory leak in Raster_flush closed
@@ -65,7 +70,7 @@
*
* exported fuctions:
*
- * struct DISPLAY MatrixOrbital[]
+ * struct LCD MatrixOrbital[]
*
*/
@@ -86,7 +91,7 @@
#define CHARS 8
#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 )
-static DISPLAY Display;
+static LCD Lcd;
static char *Port=NULL;
static speed_t Speed;
static int Device=-1;
@@ -172,8 +177,8 @@ static void MO_process_bars (void)
}
nSegment=i;
- for (row=0; row<Display.rows; row++) {
- for (col=0; col<Display.cols; col++) {
+ for (row=0; row<Lcd.rows; row++) {
+ for (col=0; col<Lcd.cols; col++) {
if (Bar[row][col].type==0) continue;
for (i=0; i<nSegment; i++) {
if (Segment[i].type & Bar[row][col].type &&
@@ -263,8 +268,8 @@ static void MO_compact_bars (void)
error[i][pack_i]=error[i][nSegment];
}
- for (r=0; r<Display.rows; r++) {
- for (c=0; c<Display.cols; c++) {
+ for (r=0; r<Lcd.rows; r++) {
+ for (c=0; c<Lcd.cols; c++) {
if (Bar[r][c].segment==pack_i)
Bar[r][c].segment=pack_j;
if (Bar[r][c].segment==nSegment)
@@ -331,8 +336,8 @@ int MO_clear (void)
{
int row, col;
- for (row=0; row<Display.rows; row++) {
- for (col=0; col<Display.cols; col++) {
+ for (row=0; row<Lcd.rows; row++) {
+ for (col=0; col<Lcd.cols; col++) {
Txt[row][col]='\t';
Bar[row][col].len1=-1;
Bar[row][col].len2=-1;
@@ -344,12 +349,12 @@ int MO_clear (void)
return 0;
}
-int MO_init (DISPLAY *Self)
+int MO_init (LCD *Self)
{
char *port;
char *speed;
- Display=*Self;
+ Lcd=*Self;
if (Port) {
free (Port);
@@ -404,7 +409,7 @@ int MO_put (int row, int col, char *text)
char *p=&Txt[row][col];
char *t=text;
- while (*t && col++<=Display.cols) {
+ while (*t && col++<=Lcd.cols) {
*p++=*t++;
}
return 0;
@@ -427,7 +432,7 @@ int MO_bar (int type, int row, int col, int max, int len1, int len2)
rev=1;
case BAR_R:
- while (max>0 && col<=Display.cols) {
+ while (max>0 && col<=Lcd.cols) {
Bar[row][col].type=type;
Bar[row][col].segment=-1;
if (len1>=XRES) {
@@ -455,7 +460,7 @@ int MO_bar (int type, int row, int col, int max, int len1, int len2)
rev=1;
case BAR_D:
- while (max>0 && row<=Display.rows) {
+ while (max>0 && row<=Lcd.rows) {
Bar[row][col].type=type;
Bar[row][col].segment=-1;
if (len1>=YRES) {
@@ -495,19 +500,19 @@ int MO_flush (void)
Segment[s].used=0;
}
- for (row=0; row<Display.rows; row++) {
+ for (row=0; row<Lcd.rows; row++) {
buffer[3]=row+1;
- for (col=0; col<Display.cols; col++) {
+ for (col=0; col<Lcd.cols; col++) {
s=Bar[row][col].segment;
if (s!=-1) {
Segment[s].used=1;
Txt[row][col]=Segment[s].ascii;
}
}
- for (col=0; col<Display.cols; col++) {
+ for (col=0; col<Lcd.cols; col++) {
if (Txt[row][col]=='\t') continue;
buffer[2]=col+1;
- for (p=buffer+4; col<Display.cols; col++, p++) {
+ for (p=buffer+4; col<Lcd.cols; col++, p++) {
if (Txt[row][col]=='\t') break;
*p=Txt[row][col];
}
@@ -518,7 +523,7 @@ int MO_flush (void)
}
-DISPLAY MatrixOrbital[] = {
+LCD MatrixOrbital[] = {
{ "LCD0821", 2, 8, XRES, YRES, BARS, MO_init, MO_clear, MO_put, MO_bar, MO_flush },
{ "LCD1621", 2, 16, XRES, YRES, BARS, MO_init, MO_clear, MO_put, MO_bar, MO_flush },
{ "LCD2021", 2, 20, XRES, YRES, BARS, MO_init, MO_clear, MO_put, MO_bar, MO_flush },
diff --git a/README.Drivers b/README.Drivers
index f5cccc5..c8163a5 100644
--- a/README.Drivers
+++ b/README.Drivers
@@ -1,5 +1,5 @@
#
-# $Id: README.Drivers,v 1.1 2000/03/19 08:41:28 reinelt Exp $
+# $Id: README.Drivers,v 1.2 2000/03/26 18:46:28 reinelt Exp $
#
How to write new display drivers for lcd4linux
@@ -16,18 +16,18 @@ this guidelines:
* create one (or more) unique display names (your driver will be selected by
this name in the 'Display'-line of lcd4linux.conf).
-* include "display.h" in your driver, to get the DISPLAY structure and various
+* include "display.h" in your driver, to get the LCD structure and various
BAR_ definitions
* include "cfg.h" if you need to access settings in the config file.
-* create a DISPLAY table at the bottom of your driver, and fill it with the
+* create a LCD table at the bottom of your driver, and fill it with the
appropriate values. Take care that you specify the correct bar capabilities
of your display or driver!
-* edit display.c and create a reference to your DISPLAY table:
+* edit display.c and create a reference to your LCD table:
- external DISPLAY YourDriver[];
+ external LCD YourDriver[];
* extend the FAMILY table in display.c with your driver:
diff --git a/Raster.c b/Raster.c
index f4f86f4..295e973 100644
--- a/Raster.c
+++ b/Raster.c
@@ -1,4 +1,4 @@
-/* $Id: Raster.c,v 1.4 2000/03/26 12:55:03 reinelt Exp $
+/* $Id: Raster.c,v 1.5 2000/03/26 18:46:28 reinelt Exp $
*
* driver for raster formats
*
@@ -20,6 +20,11 @@
*
*
* $Log: Raster.c,v $
+ * Revision 1.5 2000/03/26 18:46:28 reinelt
+ *
+ * bug in pixmap.c that leaded to empty bars fixed
+ * name conflicts with X11 resolved
+ *
* Revision 1.4 2000/03/26 12:55:03 reinelt
*
* enhancements to the PPM driver
@@ -45,7 +50,7 @@
*
* exported fuctions:
*
- * struct DISPLAY Raster[]
+ * struct LCD Raster[]
*
*/
@@ -64,7 +69,7 @@
#define BARS ( BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 )
-static DISPLAY Display;
+static LCD Lcd;
static int pixel=-1;
static int pgap=0;
@@ -89,8 +94,8 @@ int Raster_flush (void)
char path[256], tmp[256], buffer[256];
int fd;
- xsize=2*border+(Display.cols-1)*cgap+Display.cols*Display.xres*pixel+(Display.cols*Display.xres-1)*pgap;
- ysize=2*border+(Display.rows-1)*rgap+Display.rows*Display.yres*pixel+(Display.rows*Display.yres-1)*pgap;
+ xsize=2*border+(Lcd.cols-1)*cgap+Lcd.cols*Lcd.xres*pixel+(Lcd.cols*Lcd.xres-1)*pgap;
+ ysize=2*border+(Lcd.rows-1)*rgap+Lcd.rows*Lcd.yres*pixel+(Lcd.rows*Lcd.yres-1)*pgap;
if (bitbuf==NULL) {
if ((bitbuf=malloc(xsize*ysize*sizeof(*bitbuf)))==NULL) {
@@ -108,14 +113,14 @@ int Raster_flush (void)
memset (bitbuf, 0, xsize*ysize*sizeof(*bitbuf));
- for (row=0; row<Display.rows*Display.yres; row++) {
- int y=border+(row/Display.yres)*rgap+row*(pixel+pgap);
- for (col=0; col<Display.cols*Display.xres; col++) {
- int x=border+(col/Display.xres)*cgap+col*(pixel+pgap);
+ for (row=0; row<Lcd.rows*Lcd.yres; row++) {
+ int y=border+(row/Lcd.yres)*rgap+row*(pixel+pgap);
+ for (col=0; col<Lcd.cols*Lcd.xres; col++) {
+ int x=border+(col/Lcd.xres)*cgap+col*(pixel+pgap);
int a, b;
for (a=0; a<pixel; a++)
for (b=0; b<pixel; b++)
- bitbuf[y*xsize+x+a*xsize+b]=Pixmap[row*Display.cols*Display.xres+col]+1;
+ bitbuf[y*xsize+x+a*xsize+b]=Pixmap[row*Lcd.cols*Lcd.xres+col]+1;
}
}
@@ -179,7 +184,7 @@ int Raster_clear (void)
return 0;
}
-int Raster_init (DISPLAY *Self)
+int Raster_init (LCD *Self)
{
char *s;
int rows=-1, cols=-1;
@@ -225,7 +230,7 @@ int Raster_init (DISPLAY *Self)
Self->cols=cols;
Self->xres=xres;
Self->yres=yres;
- Display=*Self;
+ Lcd=*Self;
pix_clear();
return 0;
@@ -242,7 +247,7 @@ int Raster_bar (int type, int row, int col, int max, int len1, int len2)
}
-DISPLAY Raster[] = {
+LCD Raster[] = {
{ "PPM", 0, 0, 0, 0, BARS, Raster_init, Raster_clear, Raster_put, Raster_bar, Raster_flush },
{ NULL }
};
diff --git a/Skeleton.c b/Skeleton.c
index 8dcd8b1..b583913 100644
--- a/Skeleton.c
+++ b/Skeleton.c
@@ -1,4 +1,4 @@
-/* $Id: Skeleton.c,v 1.3 2000/03/25 05:50:43 reinelt Exp $
+/* $Id: Skeleton.c,v 1.4 2000/03/26 18:46:28 reinelt Exp $
*
* skeleton driver for new display modules
*
@@ -20,6 +20,11 @@
*
*
* $Log: Skeleton.c,v $
+ * Revision 1.4 2000/03/26 18:46:28 reinelt
+ *
+ * bug in pixmap.c that leaded to empty bars fixed
+ * name conflicts with X11 resolved
+ *
* Revision 1.3 2000/03/25 05:50:43 reinelt
*
* memory leak in Raster_flush closed
@@ -41,7 +46,7 @@
*
* exported fuctions:
*
- * struct DISPLAY Skeleton[]
+ * struct LCD Skeleton[]
*
*/
@@ -51,16 +56,16 @@
#include "cfg.h"
#include "display.h"
-static DISPLAY Display;
+static LCD Lcd;
int Skel_clear (void)
{
return 0;
}
-int Skel_init (DISPLAY *Self)
+int Skel_init (LCD *Self)
{
- Display=*Self;
+ Lcd=*Self;
fprintf (stderr, "Skeleton: This driver does not drive anything!");
return -1;
@@ -85,7 +90,7 @@ int Skel_flush (void)
}
-DISPLAY Skeleton[] = {
+LCD Skeleton[] = {
{ "Skeleton", 4, 20, 5, 8, BAR_L | BAR_R, Skel_init, Skel_clear, Skel_put, Skel_bar, Skel_flush },
{ NULL }
};
diff --git a/XWindow.c b/XWindow.c
index 0072a94..d52c7ac 100644
--- a/XWindow.c
+++ b/XWindow.c
@@ -1,4 +1,4 @@
-/* $Id: XWindow.c,v 1.4 2000/03/25 05:50:43 reinelt Exp $
+/* $Id: XWindow.c,v 1.5 2000/03/26 18:46:28 reinelt Exp $
*
* driver for X11
*
@@ -20,6 +20,11 @@
*
*
* $Log: XWindow.c,v $
+ * Revision 1.5 2000/03/26 18:46:28 reinelt
+ *
+ * bug in pixmap.c that leaded to empty bars fixed
+ * name conflicts with X11 resolved
+ *
* Revision 1.4 2000/03/25 05:50:43 reinelt
*
* memory leak in Raster_flush closed
@@ -47,7 +52,7 @@
*
* exported fuctions:
*
- * struct DISPLAY XWindow[]
+ * struct LCD XWindow[]
*
*/
@@ -71,7 +76,7 @@ static int foreground=0;
static int halfground=0;
static int background=0;
-static DISPLAY Display;
+static LCD Lcd;
int X_flush (void)
{
@@ -79,22 +84,22 @@ int X_flush (void)
unsigned char *buffer;
unsigned char R[3], G[3], B[3];
- xsize=2*border+(Display.cols-1)*cgap+Display.cols*Display.xres*(pixel+pgap);
- ysize=2*border+(Display.rows-1)*rgap+Display.rows*Display.yres*(pixel+pgap);
+ xsize=2*border+(Lcd.cols-1)*cgap+Lcd.cols*Lcd.xres*(pixel+pgap);
+ ysize=2*border+(Lcd.rows-1)*rgap+Lcd.rows*Lcd.yres*(pixel+pgap);
if ((buffer=malloc(xsize*ysize*sizeof(*buffer)))==NULL)
return -1;
memset (buffer, 0, xsize*ysize*sizeof(*buffer));
- for (row=0; row<Display.rows*Display.yres; row++) {
- int y=border+(row/Display.yres)*rgap+row*(pixel+pgap);
- for (col=0; col<Display.cols*Display.xres; col++) {
- int x=border+(col/Display.xres)*cgap+col*(pixel+pgap);
+ for (row=0; row<Lcd.rows*Lcd.yres; row++) {
+ int y=border+(row/Lcd.yres)*rgap+row*(pixel+pgap);
+ for (col=0; col<Lcd.cols*Lcd.xres; col++) {
+ int x=border+(col/Lcd.xres)*cgap+col*(pixel+pgap);
int a, b;
for (a=0; a<pixel; a++)
for (b=0; b<pixel; b++)
- buffer[y*xsize+x+a*xsize+b]=Pixmap[row*Display.cols*Display.xres+col]+1;
+ buffer[y*xsize+x+a*xsize+b]=Pixmap[row*Lcd.cols*Lcd.xres+col]+1;
}
}
@@ -131,7 +136,7 @@ int X_clear (void)
return 0;
}
-int X_init (DISPLAY *Self)
+int X_init (LCD *Self)
{
char *s;
int rows=-1, cols=-1;
@@ -172,7 +177,7 @@ int X_init (DISPLAY *Self)
Self->cols=cols;
Self->xres=xres;
Self->yres=yres;
- Display=*Self;
+ Lcd=*Self;
pix_clear();
return 0;
@@ -189,7 +194,7 @@ int X_bar (int type, int row, int col, int max, int len1, int len2)
}
-DISPLAY XWindow[] = {
+LCD XWindow[] = {
{ "X11", 0, 0, 0, 0, BARS, X_init, X_clear, X_put, X_bar, X_flush },
{ NULL }
};
diff --git a/display.c b/display.c
index c4f545b..58f333b 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.11 2000/03/25 05:50:43 reinelt Exp $
+/* $Id: display.c,v 1.12 2000/03/26 18:46:28 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,11 @@
*
*
* $Log: display.c,v $
+ * Revision 1.12 2000/03/26 18:46:28 reinelt
+ *
+ * bug in pixmap.c that leaded to empty bars fixed
+ * name conflicts with X11 resolved
+ *
* Revision 1.11 2000/03/25 05:50:43 reinelt
*
* memory leak in Raster_flush closed
@@ -76,7 +81,7 @@
* lcd_list (void)
* lists all available drivers to stdout
*
- * lcd_init (char *display)
+ * lcd_init (char *driver)
* initializes the named driver
*
* lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars)
@@ -103,21 +108,21 @@
#include "cfg.h"
#include "display.h"
-extern DISPLAY Skeleton[];
-extern DISPLAY MatrixOrbital[];
-extern DISPLAY Raster[];
-extern DISPLAY XWindow[];
+extern LCD Skeleton[];
+extern LCD MatrixOrbital[];
+extern LCD Raster[];
+extern LCD XWindow[];
FAMILY Driver[] = {
{ "Skeleton", Skeleton },
{ "Matrix Orbital", MatrixOrbital },
- { "Raster", Raster },
+ { "Raster", Raster },
{ "X Window System", XWindow },
{ NULL }
};
-static DISPLAY *Display = NULL;
+static LCD *Lcd = NULL;
int lcd_list (void)
{
@@ -127,68 +132,68 @@ int lcd_list (void)
for (i=0; Driver[i].name; i++) {
printf ("\n %-16s:", Driver[i].name);
- for (j=0; Driver[i].Display[j].name; j++) {
- printf (" %s", Driver[i].Display[j].name);
+ for (j=0; Driver[i].Model[j].name; j++) {
+ printf (" %s", Driver[i].Model[j].name);
}
}
printf ("\n");
return 0;
}
-int lcd_init (char *display)
+int lcd_init (char *driver)
{
int i, j;
for (i=0; Driver[i].name; i++) {
- for (j=0; Driver[i].Display[j].name; j++) {
- if (strcmp (Driver[i].Display[j].name, display)==0) {
- Display=&Driver[i].Display[j];
- return Display->init(Display);
+ for (j=0; Driver[i].Model[j].name; j++) {
+ if (strcmp (Driver[i].Model[j].name, driver)==0) {
+ Lcd=&Driver[i].Model[j];
+ return Lcd->init(Lcd);
}
}
}
- fprintf (stderr, "lcd_init(%s) failed: no such display\n", display);
+ fprintf (stderr, "lcd_init(%s) failed: no such display\n", driver);
return -1;
}
int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars)
{
- if (Display==NULL)
+ if (Lcd==NULL)
return -1;
- *rows=Display->rows;
- *cols=Display->cols;
- *xres=Display->xres;
- *yres=Display->yres;
- *bars=Display->bars;
+ *rows=Lcd->rows;
+ *cols=Lcd->cols;
+ *xres=Lcd->xres;
+ *yres=Lcd->yres;
+ *bars=Lcd->bars;
return 0;
}
int lcd_clear (void)
{
- return Display->clear();
+ return Lcd->clear();
}
int lcd_put (int row, int col, char *text)
{
- if (row<1 || row>Display->rows) return -1;
- if (col<1 || col>Display->cols) return -1;
- return Display->put(row-1, col-1, text);
+ if (row<1 || row>Lcd->rows) return -1;
+ if (col<1 || col>Lcd->cols) return -1;
+ return Lcd->put(row-1, col-1, text);
}
int lcd_bar (int type, int row, int col, int max, int len1, int len2)
{
- if (row<1 || row>Display->rows) return -1;
- if (col<1 || col>Display->cols) return -1;
+ if (row<1 || row>Lcd->rows) return -1;
+ if (col<1 || col>Lcd->cols) return -1;
if (!(type & (BAR_H2 | BAR_V2))) len2=len1;
if (type & BAR_LOG) {
len1=(double)max*log(len1+1)/log(max);
len2=(double)max*log(len2+1)/log(max);
}
- return Display->bar (type & BAR_HV, row-1, col-1, max, len1, len2);
+ return Lcd->bar (type & BAR_HV, row-1, col-1, max, len1, len2);
}
int lcd_flush (void)
{
- return Display->flush();
+ return Lcd->flush();
}
diff --git a/display.h b/display.h
index f519467..24184f9 100644
--- a/display.h
+++ b/display.h
@@ -1,4 +1,4 @@
-/* $Id: display.h,v 1.9 2000/03/25 05:50:43 reinelt Exp $
+/* $Id: display.h,v 1.10 2000/03/26 18:46:28 reinelt Exp $
*
* framework for device drivers
*
@@ -20,6 +20,11 @@
*
*
* $Log: display.h,v $
+ * Revision 1.10 2000/03/26 18:46:28 reinelt
+ *
+ * bug in pixmap.c that leaded to empty bars fixed
+ * name conflicts with X11 resolved
+ *
* Revision 1.9 2000/03/25 05:50:43 reinelt
*
* memory leak in Raster_flush closed
@@ -73,27 +78,27 @@
#define BAR_V (BAR_U | BAR_D)
#define BAR_HV (BAR_H | BAR_V)
-typedef struct DISPLAY {
+typedef struct LCD {
char *name;
int rows;
int cols;
int xres;
int yres;
int bars;
- int (*init) (struct DISPLAY *Self);
+ int (*init) (struct LCD *Self);
int (*clear) (void);
int (*put) (int x, int y, char *text);
int (*bar) (int type, int x, int y, int max, int len1, int len2);
int (*flush) (void);
-} DISPLAY;
+} LCD;
typedef struct {
char *name;
- DISPLAY *Display;
+ LCD *Model;
} FAMILY;
int lcd_list (void);
-int lcd_init (char *display);
+int lcd_init (char *driver);
int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars);
int lcd_clear (void);
int lcd_put (int row, int col, char *text);
diff --git a/lcd4linux.c b/lcd4linux.c
index 3d9d55b..88cbf6b 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.13 2000/03/26 12:55:03 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.14 2000/03/26 18:46:28 reinelt Exp $
*
* LCD4Linux
*
@@ -20,6 +20,11 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.14 2000/03/26 18:46:28 reinelt
+ *
+ * bug in pixmap.c that leaded to empty bars fixed
+ * name conflicts with X11 resolved
+ *
* Revision 1.13 2000/03/26 12:55:03 reinelt
*
* enhancements to the PPM driver
@@ -105,7 +110,7 @@ static void usage(void)
void main (int argc, char *argv[])
{
char *cfg="/etc/lcd4linux.conf";
- char *display;
+ char *driver;
int c, smooth;
while ((c=getopt (argc, argv, "hlf:o:"))!=EOF) {
@@ -143,12 +148,12 @@ void main (int argc, char *argv[])
if (cfg_read (cfg)==-1)
exit (1);
- display=cfg_get("display");
- if (display==NULL || *display=='\0') {
+ driver=cfg_get("display");
+ if (driver==NULL || *driver=='\0') {
fprintf (stderr, "%s: missing 'display' entry!\n", cfg_file());
exit (1);
}
- if (lcd_init(display)==-1) {
+ if (lcd_init(driver)==-1) {
exit (1);
}
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index aad16c6..4c27373 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -3,16 +3,20 @@
#Speed 19200
#Contrast 160
-#Display X11
-DISPLAY PPM
+Display xlcd
+#Display PPM
size 20x4
font 5x8
-pixel 3+1
-gap 4x4
+pixel 3+0
+gap 3x3
border 5
-foreground 102000
-halfground 70c000
-background 80d000
+foreground black
+halfground gray
+background wheat
+
+#foreground 102000
+#halfground 70c000
+#background 80d000
#Row1 "*** %o %v ***"
diff --git a/pixmap.c b/pixmap.c
index 3f20c9e..c266a65 100644
--- a/pixmap.c
+++ b/pixmap.c
@@ -1,4 +1,4 @@
-/* $Id: pixmap.c,v 1.4 2000/03/25 05:50:43 reinelt Exp $
+/* $Id: pixmap.c,v 1.5 2000/03/26 18:46:28 reinelt Exp $
*
* generic pixmap driver
*
@@ -20,6 +20,11 @@
*
*
* $Log: pixmap.c,v $
+ * Revision 1.5 2000/03/26 18:46:28 reinelt
+ *
+ * bug in pixmap.c that leaded to empty bars fixed
+ * name conflicts with X11 resolved
+ *
* Revision 1.4 2000/03/25 05:50:43 reinelt
*
* memory leak in Raster_flush closed
@@ -72,14 +77,14 @@ static int COLS=0;
static int XRES=0;
static int YRES=0;
-unsigned char *Pixmap=NULL;
+unsigned char *LCDpixmap=NULL;
int pix_clear(void)
{
int i;
for (i=0; i<ROWS*COLS; i++) {
- Pixmap[i]=0;
+ LCDpixmap[i]=0;
}
return 0;
@@ -90,15 +95,15 @@ int pix_init (int rows, int cols, int xres, int yres)
if (rows<1 || cols<1 || xres<1 || yres<1)
return -1;
- if (Pixmap)
- free (Pixmap);
+ if (LCDpixmap)
+ free (LCDpixmap);
XRES=xres;
YRES=yres;
ROWS=rows*yres;
COLS=cols*xres;
- if ((Pixmap=malloc (ROWS*COLS*sizeof(unsigned char)))==NULL)
+ if ((LCDpixmap=malloc (ROWS*COLS*sizeof(unsigned char)))==NULL)
return -1;
return pix_clear();
@@ -113,11 +118,13 @@ int pix_put (int row, int col, char *text)
while (*text && col<COLS) {
c=*(unsigned char*)text;
- for (y=0; y<YRES; y++) {
- mask=1<<XRES;
- for (x=0; x<XRES; x++) {
- mask>>=1;
- Pixmap[(row+y)*COLS+col+x]=Fontmap[c][y]&mask?1:0;
+ if (c!='\t') {
+ for (y=0; y<YRES; y++) {
+ mask=1<<XRES;
+ for (x=0; x<XRES; x++) {
+ mask>>=1;
+ LCDpixmap[(row+y)*COLS+col+x]=Fontmap[c][y]&mask?1:0;
+ }
}
}
col+=XRES;
@@ -159,7 +166,7 @@ int pix_bar (int type, int row, int col, int max, int len1, int len2)
for (y=0; y<YRES; y++) {
len=y<YRES/2?len1:len2;
for (x=0; x<max; x++) {
- Pixmap[(row+y)*COLS+col+x]=x<len?!rev:rev;
+ LCDpixmap[(row+y)*COLS+col+x]=x<len?!rev:rev;
}
}
break;
@@ -173,7 +180,7 @@ int pix_bar (int type, int row, int col, int max, int len1, int len2)
for (y=0; y<max; y++) {
for (x=0; x<XRES; x++) {
len=x<XRES/2?len1:len2;
- Pixmap[(row+y)*COLS+col+x]=y<len?!rev:rev;
+ LCDpixmap[(row+y)*COLS+col+x]=y<len?!rev:rev;
}
}
break;