diff options
-rw-r--r-- | BeckmannEgle.c | 28 | ||||
-rw-r--r-- | Crystalfontz.c | 34 | ||||
-rw-r--r-- | Cwlinux.c | 86 | ||||
-rw-r--r-- | MatrixOrbital.c | 22 | ||||
-rw-r--r-- | PalmPilot.c | 22 | ||||
-rw-r--r-- | SIN.c | 7 | ||||
-rw-r--r-- | Skeleton.c | 14 | ||||
-rw-r--r-- | T6963.c | 25 | ||||
-rw-r--r-- | Text.c | 7 |
9 files changed, 188 insertions, 57 deletions
diff --git a/BeckmannEgle.c b/BeckmannEgle.c index 622dcb6..cf52de8 100644 --- a/BeckmannEgle.c +++ b/BeckmannEgle.c @@ -1,4 +1,4 @@ -/* $Id: BeckmannEgle.c,v 1.15 2003/08/24 05:17:58 reinelt Exp $ +/* $Id: BeckmannEgle.c,v 1.16 2003/09/13 06:45:43 reinelt Exp $ * * driver for Beckmann+Egle mini terminals * @@ -20,6 +20,9 @@ * * * $Log: BeckmannEgle.c,v $ + * Revision 1.16 2003/09/13 06:45:43 reinelt + * icons for all remaining drivers + * * Revision 1.15 2003/08/24 05:17:58 reinelt * liblcd4linux patch from Patrick Schemitz * @@ -95,6 +98,7 @@ #include "lock.h" #include "display.h" #include "bar.h" +#include "icon.h" #define XRES 5 #define YRES 8 @@ -110,6 +114,7 @@ static LCD Lcd; static char *Port=NULL; static int Device=-1; static int Type=-1; +static int Icons; static char *FrameBuffer1=NULL; static char *FrameBuffer2=NULL; @@ -208,6 +213,8 @@ int BE_clear (int full) { memset (FrameBuffer1, ' ', Lcd.rows*Lcd.cols*sizeof(char)); + + icon_clear(); bar_clear(); if (full) { @@ -280,7 +287,15 @@ int BE_init (LCD *Self) BE_write (buffer, 4); // select display type BE_write ("\033&D", 3); // cursor off - bar_init(rows, cols, XRES, YRES, CHARS); + if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1; + if (Icons>0) { + debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS); + icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, BE_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 bar_add_segment(255,255,255,255); // ASCII 255 = block @@ -316,6 +331,12 @@ int BE_bar (int type, int row, int col, int max, int len1, int len2) } +int BE_icon (int num, int seq, int row, int col) +{ + return icon_draw (num, seq, row, col); +} + + int BE_flush (void) { int row, col, pos1, pos2; @@ -326,6 +347,7 @@ int BE_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) { FrameBuffer1[row*Lcd.cols+col]=(char)c; } @@ -382,11 +404,13 @@ LCD BeckmannEgle[] = { xres: XRES, yres: YRES, bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, + icons: 0, gpos: 0, init: BE_init, clear: BE_clear, put: BE_put, bar: BE_bar, + icon: BE_icon, gpo: NULL, flush: BE_flush, quit: BE_quit diff --git a/Crystalfontz.c b/Crystalfontz.c index 5b4fe6f..95be970 100644 --- a/Crystalfontz.c +++ b/Crystalfontz.c @@ -1,4 +1,4 @@ -/* $Id: Crystalfontz.c,v 1.14 2003/09/09 06:54:43 reinelt Exp $ +/* $Id: Crystalfontz.c,v 1.15 2003/09/13 06:45:43 reinelt Exp $ * * driver for display modules from Crystalfontz * @@ -19,6 +19,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: Crystalfontz.c,v $ + * Revision 1.15 2003/09/13 06:45:43 reinelt + * icons for all remaining drivers + * * Revision 1.14 2003/09/09 06:54:43 reinelt * new function 'cfg_number()' * @@ -80,6 +83,7 @@ #include "lock.h" #include "display.h" #include "bar.h" +#include "icon.h" #define XRES 5 #define YRES 8 @@ -89,6 +93,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; @@ -180,6 +185,8 @@ static void CF_define_char (int ascii, char *buffer) static int CF_clear (int full) { memset (FrameBuffer1, ' ', Lcd.rows*Lcd.cols*sizeof(char)); + + icon_clear(); bar_clear(); GPO=0; @@ -245,7 +252,15 @@ static int CF_init (LCD *Self) Device=CF_open(); if (Device==-1) return -1; - bar_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS); + if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1; + if (Icons>0) { + debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS); + icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, CF_define_char); + 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 @@ -297,6 +312,12 @@ int CF_bar (int type, int row, int col, int max, int len1, int len2) } +int CF_icon (int num, int seq, int row, int col) +{ + return icon_draw (num, seq, row, col); +} + + static int CF_flush (void) { int row, col, pos1, pos2; @@ -307,6 +328,7 @@ static int CF_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+=128; //blank FrameBuffer1[row*Lcd.cols+col]=(char)c; @@ -364,11 +386,13 @@ LCD Crystalfontz[] = { xres: XRES, yres: YRES, bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, + icons: 0, gpos: 0, init: CF_init, clear: CF_clear, put: CF_put, bar: CF_bar, + icon: CF_icon, gpo: NULL, flush: CF_flush, quit: CF_quit @@ -379,11 +403,13 @@ LCD Crystalfontz[] = { xres: XRES, yres: YRES, bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, + icons: 0, gpos: 0, init: CF_init, clear: CF_clear, put: CF_put, bar: CF_bar, + icon: CF_icon, gpo: NULL, flush: CF_flush, quit: CF_quit @@ -394,11 +420,13 @@ LCD Crystalfontz[] = { xres: XRES, yres: YRES, bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, + icons: 0, gpos: 0, init: CF_init, clear: CF_clear, put: CF_put, bar: CF_bar, + icon: CF_icon, gpo: NULL, flush: CF_flush, quit: CF_quit @@ -409,11 +437,13 @@ LCD Crystalfontz[] = { xres: XRES, yres: YRES, bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, + icons: 0, gpos: 0, init: CF_init, clear: CF_clear, put: CF_put, bar: CF_bar, + icon: CF_icon, gpo: NULL, flush: CF_flush, quit: CF_quit @@ -1,4 +1,4 @@ -/* $Id: Cwlinux.c,v 1.13 2003/09/09 06:54:43 reinelt Exp $ +/* $Id: Cwlinux.c,v 1.14 2003/09/13 06:45:43 reinelt Exp $ * * driver for Cwlinux serial display modules * @@ -20,6 +20,9 @@ * * * $Log: Cwlinux.c,v $ + * Revision 1.14 2003/09/13 06:45:43 reinelt + * icons for all remaining drivers + * * Revision 1.13 2003/09/09 06:54:43 reinelt * new function 'cfg_number()' * @@ -82,6 +85,7 @@ #include "lock.h" #include "display.h" #include "bar.h" +#include "icon.h" #define CHARS 8 @@ -89,6 +93,7 @@ static LCD Lcd; static char *Port = NULL; static speed_t Speed; static int Device = -1; +static int Icons; static char *FrameBuffer1=NULL; static char *FrameBuffer2=NULL; @@ -220,6 +225,8 @@ int CW_clear(int full) { memset (FrameBuffer1, ' ', Lcd.rows*Lcd.cols*sizeof(char)); + + icon_clear(); bar_clear(); if (full) { @@ -345,7 +352,15 @@ int CW_init(LCD * Self) // backlight brightness CW_Brightness(); - bar_init(Lcd.rows, Lcd.cols, Lcd.xres, Lcd.yres, CHARS); + if (cfg_number("Icons", 0, 0, CHARS, &Icons)<0) return -1; + if (Icons>0) { + debug ("reserving %d of %d user-defined characters for icons", Icons, CHARS); + icon_init(Lcd.rows, Lcd.cols, Lcd.xres, Lcd.yres, CHARS, Icons, CW12232_define_char); + Self->icons=Icons; + Lcd.icons=Icons; + } + + bar_init(Lcd.rows, Lcd.cols, Lcd.xres, Lcd.yres, CHARS-Icons); bar_add_segment( 0, 0,255, 32); // ASCII 32 = blank return 0; @@ -370,6 +385,12 @@ int CW_bar(int type, int row, int col, int max, int len1, int len2) } +int CW_icon (int num, int seq, int row, int col) +{ + return icon_draw (num, seq, row, col); +} + + int CW_flush(void) { int row, col, pos1, pos2; @@ -378,6 +399,7 @@ int CW_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++; //blank FrameBuffer1[row*Lcd.cols+col]=(char)c; @@ -442,35 +464,39 @@ int CW_quit(void) LCD Cwlinux[] = { - {name: "CW12232", - rows: 4, - cols: 20, - xres: 6, - yres: 8, - bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, - gpos: 0, - init: CW_init, - clear: CW_clear, - put: CW_put, - bar: CW_bar, - gpo: NULL, - flush: CW12232_flush, - quit: CW_quit + { name: "CW12232", + rows: 4, + cols: 20, + xres: 6, + yres: 8, + bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, + icons: 0, + gpos: 0, + init: CW_init, + clear: CW_clear, + put: CW_put, + bar: CW_bar, + icon: CW_icon, + gpo: NULL, + flush: CW12232_flush, + quit: CW_quit }, - {name: "CW1602", - rows: 2, - cols: 16, - xres: 5, - yres: 8, - bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, - gpos: 0, - init: CW_init, - clear: CW_clear, - put: CW_put, - bar: CW_bar, - gpo: NULL, - flush: CW1602_flush, - quit: CW_quit + { name: "CW1602", + rows: 2, + cols: 16, + xres: 5, + yres: 8, + bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, + icons: 0, + gpos: 0, + init: CW_init, + clear: CW_clear, + put: CW_put, + bar: CW_bar, + icon: CW_icon, + gpo: NULL, + flush: CW1602_flush, + quit: CW_quit }, {NULL} }; diff --git a/MatrixOrbital.c b/MatrixOrbital.c index ac947eb..1ce3b2b 100644 --- a/MatrixOrbital.c +++ b/MatrixOrbital.c @@ -1,4 +1,4 @@ -/* $Id: MatrixOrbital.c,v 1.40 2003/09/11 04:09:53 reinelt Exp $ +/* $Id: MatrixOrbital.c,v 1.41 2003/09/13 06:45:43 reinelt Exp $ * * driver for Matrix Orbital serial display modules * @@ -20,6 +20,9 @@ * * * $Log: MatrixOrbital.c,v $ + * Revision 1.41 2003/09/13 06:45:43 reinelt + * icons for all remaining drivers + * * Revision 1.40 2003/09/11 04:09:53 reinelt * minor cleanups * @@ -196,8 +199,8 @@ #include "cfg.h" #include "lock.h" #include "display.h" -#include "icon.h" #include "bar.h" +#include "icon.h" #define XRES 5 #define YRES 8 @@ -439,21 +442,6 @@ int MO_bar (int type, int row, int col, int max, int len1, int len2) } -int MO_icon_old (int num, int row, int col, unsigned char *bitmap) -{ - // icons use last ascii codes - char ascii=CHARS-num; - - MO_define_char (ascii, bitmap); - MO_goto(row, col); - MO_write(&ascii, 1); - FrameBuffer1[row*Lcd.cols+col]=(char)ascii; - FrameBuffer2[row*Lcd.cols+col]=(char)ascii; - - return 0; -} - - int MO_icon (int num, int seq, int row, int col) { return icon_draw (num, seq, row, col); diff --git a/PalmPilot.c b/PalmPilot.c index 502374f..60dcf18 100644 --- a/PalmPilot.c +++ b/PalmPilot.c @@ -1,4 +1,4 @@ -/* $Id: PalmPilot.c,v 1.12 2003/09/09 06:54:43 reinelt Exp $ +/* $Id: PalmPilot.c,v 1.13 2003/09/13 06:45:43 reinelt Exp $ * * driver for 3Com Palm Pilot * @@ -20,6 +20,9 @@ * * * $Log: PalmPilot.c,v $ + * Revision 1.13 2003/09/13 06:45:43 reinelt + * icons for all remaining drivers + * * Revision 1.12 2003/09/09 06:54:43 reinelt * new function 'cfg_number()' * @@ -92,6 +95,7 @@ #include "lock.h" #include "display.h" #include "bar.h" +#include "icon.h" #include "pixmap.h" @@ -105,6 +109,7 @@ static int pgap=0; static int rgap=0; static int cgap=0; static int border=0; +static int icons; static int Palm_open (void) { @@ -288,10 +293,18 @@ int Palm_init (LCD *Self) return -1; } + if (cfg_number("Icons", 0, 0, 8, &icons) < 0) return -1; + if (icons>0) { + info ("allocating %d icons", icons); + icon_init(rows, cols, xres, yres, 8, icons, pix_icon); + } + + Self->rows=rows; Self->cols=cols; Self->xres=xres; Self->yres=yres; + Self->icons=icons; Lcd=*Self; // Device=open ("PalmOrb.dat", O_WRONLY | O_CREAT | O_TRUNC, 0644); @@ -313,6 +326,11 @@ int Palm_bar (int type, int row, int col, int max, int len1, int len2) return pix_bar (type, row, col, max, len1, len2); } +int Palm_icon (int num, int seq, int row, int col) +{ + return icon_draw (num, seq, row, col); +} + int Palm_quit (void) { debug ("closing port %s", Port); @@ -328,11 +346,13 @@ LCD PalmPilot[] = { xres: 0, yres: 0, bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T, + icons: 0, gpos: 0, init: Palm_init, clear: Palm_clear, put: Palm_put, bar: Palm_bar, + icon: Palm_icon, gpo: NULL, flush: Palm_flush, quit: Palm_quit }, @@ -1,4 +1,4 @@ -/* $Id: SIN.c,v 1.12 2003/08/24 05:17:58 reinelt Exp $ +/* $Id: SIN.c,v 1.13 2003/09/13 06:45:43 reinelt Exp $ * * driver for SIN router displays * @@ -20,6 +20,9 @@ * * * $Log: SIN.c,v $ + * Revision 1.13 2003/09/13 06:45:43 reinelt + * icons for all remaining drivers + * * Revision 1.12 2003/08/24 05:17:58 reinelt * liblcd4linux patch from Patrick Schemitz * @@ -291,11 +294,13 @@ LCD SIN[] = { xres: XRES, yres: YRES, bars: BAR_L | BAR_R, + icons: 0, gpos: 0, init: SIN_init, clear: SIN_clear, put: SIN_put, bar: SIN_bar, + icon: NULL, gpo: NULL, flush: SIN_flush, quit: SIN_quit }, @@ -1,4 +1,4 @@ -/* $Id: Skeleton.c,v 1.10 2003/08/17 12:11:58 reinelt Exp $ +/* $Id: Skeleton.c,v 1.11 2003/09/13 06:45:43 reinelt Exp $ * * skeleton driver for new display modules * @@ -20,6 +20,9 @@ * * * $Log: Skeleton.c,v $ + * Revision 1.11 2003/09/13 06:45:43 reinelt + * icons for all remaining drivers + * * Revision 1.10 2003/08/17 12:11:58 reinelt * framework for icons prepared * @@ -107,6 +110,11 @@ int Skel_bar (int type, int row, int col, int max, int len1, int len2) return 0; } +int Skel_icon (int num, int seq, int row, int col) +{ + return 0; +} + int Skel_gpo (int num, int val) { return 0; @@ -131,11 +139,13 @@ LCD Skeleton[] = { xres: 5, yres: 8, bars: BAR_L|BAR_R, - gpo: 0, + icons: 0, + gpos: 0, init: Skel_init, clear: Skel_clear, put: Skel_put, bar: Skel_bar, + icon: Skel_icon, gpo: Skel_gpo, flush: Skel_flush, quit: Skel_quit }, @@ -1,4 +1,4 @@ -/* $Id: T6963.c,v 1.10 2003/08/16 07:31:35 reinelt Exp $ +/* $Id: T6963.c,v 1.11 2003/09/13 06:45:43 reinelt Exp $ * * driver for display modules based on the Toshiba T6963 chip * @@ -20,6 +20,9 @@ * * * $Log: T6963.c,v $ + * Revision 1.11 2003/09/13 06:45:43 reinelt + * icons for all remaining drivers + * * Revision 1.10 2003/08/16 07:31:35 reinelt * double buffering in all drivers * @@ -74,6 +77,7 @@ #include "cfg.h" #include "display.h" #include "bar.h" +#include "icon.h" #include "parport.h" #include "udelay.h" #include "pixmap.h" @@ -83,6 +87,7 @@ #define YRES 8 static LCD Lcd; +static int Icons; unsigned char *Buffer1, *Buffer2; @@ -336,6 +341,14 @@ int T6_init (LCD *Self) return -1; } + if (cfg_number("Icons", 0, 0, 8, &Icons) < 0) return -1; + if (Icons>0) { + info ("allocating %d icons", Icons); + icon_init(Lcd.rows, Lcd.cols, Lcd.xres, Lcd.yres, 8, Icons, pix_icon); + Self->icons=Icons; + Lcd.icons=Icons; + } + Buffer1=malloc(Lcd.cols*Lcd.rows*Lcd.yres); if (Buffer1==NULL) { error ("T6963: malloc(%d) failed: %s", Lcd.cols*Lcd.rows*Lcd.yres, strerror(errno)); @@ -397,6 +410,12 @@ int T6_bar (int type, int row, int col, int max, int len1, int len2) } +int T6_icon (int num, int seq, int row, int col) +{ + return icon_draw (num, seq, row, col); +} + + int T6_flush (void) { int i, j, e; @@ -441,11 +460,13 @@ LCD T6963[] = { xres: 6, yres: 8, bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T, + icons: 0, gpos: 0, init: T6_init, clear: T6_clear, put: T6_put, bar: T6_bar, + icon: T6_icon, gpo: NULL, flush: T6_flush, quit: T6_quit @@ -456,11 +477,13 @@ LCD T6963[] = { xres: 8, yres: 8, bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2 | BAR_V2 | BAR_T, + icons: 0, gpos: 0, init: T6_init, clear: T6_clear, put: T6_put, bar: T6_bar, + icon: T6_icon, gpo: NULL, flush: T6_flush, quit: T6_quit @@ -1,4 +1,4 @@ -/* $Id: Text.c,v 1.10 2003/08/24 05:17:58 reinelt Exp $ +/* $Id: Text.c,v 1.11 2003/09/13 06:45:43 reinelt Exp $ * * pure ncurses based text driver * @@ -20,6 +20,9 @@ * * * $Log: Text.c,v $ + * Revision 1.11 2003/09/13 06:45:43 reinelt + * icons for all remaining drivers + * * Revision 1.10 2003/08/24 05:17:58 reinelt * liblcd4linux patch from Patrick Schemitz * @@ -255,11 +258,13 @@ LCD Text[] = { xres: 1, yres: 1, bars: BAR_L | BAR_R | BAR_U | BAR_D | BAR_H2, + icons: 0, gpos: 0, init: Text_init, clear: Text_clear, put: Text_put, bar: Text_bar, + icon: NULL, gpo: NULL, flush: Text_flush, quit: Text_quit |