From 947cd14666c824a02a28dd4b83540949e690e4fd Mon Sep 17 00:00:00 2001 From: reinelt Date: Mon, 1 Sep 2003 04:09:35 +0000 Subject: [lcd4linux @ 2003-09-01 04:09:34 by reinelt] icons nearly finished, but MatrixOrbital only git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@230 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- MatrixOrbital.c | 20 ++++++++++++++--- bar.c | 6 ++++- display.c | 9 +++++--- display.h | 9 +++++--- icon.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++---------- icon.h | 11 +++++++--- parser.c | 16 +++++++++++++- parser.h | 7 ++++-- processor.c | 9 +++++++- 9 files changed, 127 insertions(+), 28 deletions(-) diff --git a/MatrixOrbital.c b/MatrixOrbital.c index f392db0..bf45282 100644 --- a/MatrixOrbital.c +++ b/MatrixOrbital.c @@ -1,4 +1,4 @@ -/* $Id: MatrixOrbital.c,v 1.34 2003/08/24 05:17:58 reinelt Exp $ +/* $Id: MatrixOrbital.c,v 1.35 2003/09/01 04:09:34 reinelt Exp $ * * driver for Matrix Orbital serial display modules * @@ -20,6 +20,9 @@ * * * $Log: MatrixOrbital.c,v $ + * Revision 1.35 2003/09/01 04:09:34 reinelt + * icons nearly finished, but MatrixOrbital only + * * Revision 1.34 2003/08/24 05:17:58 reinelt * liblcd4linux patch from Patrick Schemitz * @@ -372,7 +375,7 @@ static int MO_init (LCD *Self, int protocol) Lcd.icons=Icons; } - icon_init(Lcd.rows, Lcd.cols, XRES, YRES, Icons); + icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, MO_define_char); bar_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS-Icons); bar_add_segment( 0, 0,255, 32); // ASCII 32 = blank @@ -428,7 +431,7 @@ int MO_bar (int type, int row, int col, int max, int len1, int len2) } -int MO_icon (int num, int row, int col, unsigned char *bitmap) +int MO_icon_old (int num, int row, int col, unsigned char *bitmap) { // icons use last ascii codes char ascii=CHARS-num; @@ -443,6 +446,12 @@ int MO_icon (int num, int row, int col, unsigned char *bitmap) } +int MO_icon (int num, int row, int col) +{ + return icon_draw (num, row, col); +} + + int MO_gpo (int num, int val) { if (num>=Lcd.gpos) @@ -470,6 +479,11 @@ static int MO_flush (int protocol) c=bar_peek(row, col); if (c!=-1) { FrameBuffer1[row*Lcd.cols+col]=(char)c; + } else { + c=icon_peek(row, col); + if (c!=-1) { + FrameBuffer1[row*Lcd.cols+col]=(char)c; + } } } for (col=0; colbar (type & BAR_HV, row-1, col-1, max, len1, len2); } -int lcd_icon (int num, int row, int col, unsigned char *bitmap) +int lcd_icon (int num, int row, int col) { if (num<1 || num>Lcd->icons) return -1; if (row<1 || row>Lcd->rows) return -1; if (col<1 || col>Lcd->cols) return -1; if (Lcd->icon==NULL) return 0; - return Lcd->icon(num-1, row-1, col-1, bitmap); + return Lcd->icon(num-1, row-1, col-1); } int lcd_gpo (int num, int val) diff --git a/display.h b/display.h index 9446e7e..11510aa 100644 --- a/display.h +++ b/display.h @@ -1,4 +1,4 @@ -/* $Id: display.h,v 1.19 2003/08/24 05:17:58 reinelt Exp $ +/* $Id: display.h,v 1.20 2003/09/01 04:09:34 reinelt Exp $ * * framework for device drivers * @@ -20,6 +20,9 @@ * * * $Log: display.h,v $ + * Revision 1.20 2003/09/01 04:09:34 reinelt + * icons nearly finished, but MatrixOrbital only + * * Revision 1.19 2003/08/24 05:17:58 reinelt * liblcd4linux patch from Patrick Schemitz * @@ -112,7 +115,7 @@ typedef struct LCD { int (*clear) (int full); int (*put) (int x, int y, char *text); int (*bar) (int type, int x, int y, int max, int len1, int len2); - int (*icon) (int num, int row, int col, unsigned char *bitmap); + int (*icon) (int num, int row, int col); int (*gpo) (int num, int val); int (*flush) (void); int (*quit) (void); @@ -135,7 +138,7 @@ int lcd_query (int *rows, int *cols, int *xres, int *yres, int *bars, int *icons int lcd_clear (int full); int lcd_put (int row, int col, char *text); int lcd_bar (int type, int row, int col, int max, int len1, int le2); -int lcd_icon (int num, int row, int col, unsigned char *bitmap); +int lcd_icon (int num, int row, int col); int lcd_gpo (int num, int val); int lcd_flush (void); int lcd_quit (void); diff --git a/icon.c b/icon.c index fdd9fba..ae5e332 100644 --- a/icon.c +++ b/icon.c @@ -1,4 +1,4 @@ -/* $Id: icon.c,v 1.2 2003/08/24 05:17:58 reinelt Exp $ +/* $Id: icon.c,v 1.3 2003/09/01 04:09:34 reinelt Exp $ * * generic icon and heartbeat handling * @@ -20,6 +20,9 @@ * * * $Log: icon.c,v $ + * Revision 1.3 2003/09/01 04:09:34 reinelt + * icons nearly finished, but MatrixOrbital only + * * Revision 1.2 2003/08/24 05:17:58 reinelt * liblcd4linux patch from Patrick Schemitz * @@ -32,6 +35,7 @@ #include #include +#include #include "debug.h" #include "cfg.h" @@ -42,28 +46,43 @@ static int ROWS=0; static int COLS=0; static int XRES=0; static int YRES=0; +static int CHARS; static int ICONS=0; -static int *Screen; - +static int *Screen=NULL; +static char *Bitmap=NULL; -#if 0 -static int icon_get_bitmap (int num) +static int icon_read_bitmap (int num, char *bitmap) { - int row, col; + int row, col, len; char key[15]; char *val; + char map; - for (row=1; row<=8; row++) { - snprintf (key, sizeof(key), "Icons%d.Bitmap%d", num, row); - val=cfg_get(key); + for (row=0; row len=%d", num, row, val, len); + for (col=0; col'9') { + s++; + error ("WARNING: illegal '&%c' in <%s>", *s, string); + } else { + *p++=*s++; + *p++=*s++; + } + break; + case '\\': if (*(s+1)=='\\') { *p++='\\'; diff --git a/parser.h b/parser.h index 65ae689..6987f11 100644 --- a/parser.h +++ b/parser.h @@ -1,4 +1,4 @@ -/* $Id: parser.h,v 1.12 2003/06/21 05:46:18 reinelt Exp $ +/* $Id: parser.h,v 1.13 2003/09/01 04:09:35 reinelt Exp $ * * row definition parser * @@ -20,6 +20,9 @@ * * * $Log: parser.h,v $ + * Revision 1.13 2003/09/01 04:09:35 reinelt + * icons nearly finished, but MatrixOrbital only + * * Revision 1.12 2003/06/21 05:46:18 reinelt * DVB client integrated * @@ -78,7 +81,7 @@ #define _PARSER_H_ typedef enum { - T_PERCENT=128, T_DOLLAR, + T_PERCENT=128, T_DOLLAR, T_AMPERSAND, T_OS, T_RELEASE, T_CPU, T_RAM, T_MEM_TOTAL, T_MEM_USED, T_MEM_FREE, T_MEM_SHARED, T_MEM_BUFFER, T_MEM_CACHE, T_MEM_AVAIL, T_LOAD_1, T_LOAD_2, T_LOAD_3, T_OVERLOAD, diff --git a/processor.c b/processor.c index 3972485..1ca308a 100644 --- a/processor.c +++ b/processor.c @@ -1,4 +1,4 @@ -/* $Id: processor.c,v 1.37 2003/08/24 05:17:58 reinelt Exp $ +/* $Id: processor.c,v 1.38 2003/09/01 04:09:35 reinelt Exp $ * * main data processing * @@ -20,6 +20,9 @@ * * * $Log: processor.c,v $ + * Revision 1.38 2003/09/01 04:09:35 reinelt + * icons nearly finished, but MatrixOrbital only + * * Revision 1.37 2003/08/24 05:17:58 reinelt * liblcd4linux patch from Patrick Schemitz * @@ -676,6 +679,10 @@ static char *process_row (char *data, int row, int len) *p++='\t'; } + } else if (*s=='&') { + lcd_icon(*(++s)-'0', row, p-buffer+1); + *p++='\t'; + } else { *p++=*s; } -- cgit v1.2.3