-/* $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
*
*
*
* $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
*
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
}
-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;
}
+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)
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; col<Lcd.cols; col++) {
-/* $Id: bar.c,v 1.6 2003/08/20 05:26:43 reinelt Exp $
+/* $Id: bar.c,v 1.7 2003/09/01 04:09:34 reinelt Exp $
*
* generic bar handling
*
*
*
* $Log: bar.c,v $
+ * Revision 1.7 2003/09/01 04:09:34 reinelt
+ * icons nearly finished, but MatrixOrbital only
+ *
* Revision 1.6 2003/08/20 05:26:43 reinelt
* small bug in bar compaction fixed
*
}
if ((Bar=malloc (ROWS*COLS*sizeof(BAR)))==NULL) {
+ error ("bar buffer allocation failed: out of memory");
return -1;
}
-/* $Id: display.c,v 1.39 2003/08/24 05:17:58 reinelt Exp $
+/* $Id: display.c,v 1.40 2003/09/01 04:09:34 reinelt Exp $
*
* framework for device drivers
*
*
*
* $Log: display.c,v $
+ * Revision 1.40 2003/09/01 04:09:34 reinelt
+ * icons nearly finished, but MatrixOrbital only
+ *
* Revision 1.39 2003/08/24 05:17:58 reinelt
* liblcd4linux patch from Patrick Schemitz
*
return Lcd->bar (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)
-/* $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
*
*
*
* $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
*
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);
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);
-/* $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
*
*
*
* $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
*
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include "debug.h"
#include "cfg.h"
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<YRES; row++) {
+ snprintf (key, sizeof(key), "Icon%d.Bitmap%d", num+1, row+1);
+ val=cfg_get(key, "");
+ len=strlen(val);
+ map=0;
+ debug ("read_bitmap: num=%d row=%d val=<%s> len=%d", num, row, val, len);
+ for (col=0; col<XRES; col++) {
+ map<<=1;
+ if (col<len && val[col]=='*') {
+ map|=1;
+ }
+ }
+ *(bitmap+row-1)=map;
}
+ return 0;
}
-#endif
-int icon_init (int rows, int cols, int xres, int yres, int icons)
+
+int icon_init (int rows, int cols, int xres, int yres, int chars, int icons,
+ void(*defchar)(int ascii, char *bitmap))
{
+ int n;
+
if (rows<1 || cols<1)
return -1;
COLS=cols;
XRES=xres;
YRES=yres;
+ CHARS=chars,
ICONS=icons;
if (Screen) {
}
if ((Screen=malloc(ROWS*COLS*sizeof(*Screen)))==NULL) {
+ error ("icon buffer allocation failed: out of memory");
return -1;
}
icon_clear();
+ if (Bitmap) {
+ free (Bitmap);
+ }
+
+ if ((Bitmap=malloc(YRES*icons*sizeof(*Bitmap)))==NULL) {
+ error ("icon bitmap allocation failed: out of memory");
+ return -1;
+ }
+
+ memset (Bitmap, 0, YRES*icons*sizeof(*Bitmap));
+
+ for (n=0; n<icons; n++) {
+ icon_read_bitmap(n, Bitmap+YRES*n);
+ // icons use last ascii codes from userdef chars
+ defchar (CHARS-n-1, Bitmap+YRES*n);
+ }
+
return 0;
}
}
+int icon_draw (int num, int row, int col)
+{
+ // icons use last ascii codes from userdef chars
+ Screen[row*COLS+col]=CHARS-num-1;
+ return 0;
+}
+
+
int icon_peek (int row, int col)
{
return Screen[row*COLS+col];
-/* $Id: icon.h,v 1.1 2003/08/24 04:31:56 reinelt Exp $
+/* $Id: icon.h,v 1.2 2003/09/01 04:09:35 reinelt Exp $
*
* generic icon and heartbeat handling
*
*
*
* $Log: icon.h,v $
+ * Revision 1.2 2003/09/01 04:09:35 reinelt
+ * icons nearly finished, but MatrixOrbital only
+ *
* Revision 1.1 2003/08/24 04:31:56 reinelt
* icon.c icon.h added
*
#ifndef _ICON_H_
#define _ICON_H_
-int icon_init (int rows, int cols, int xres, int yres, int icons);
+int icon_init (int rows, int cols, int xres, int yres, int chars, int icons,
+ void(*defchar)(int ascii, char *bitmap));
void icon_clear(void);
-int icon_peek (int row, int col);
+int icon_draw (int num, int row, int col);
+int icon_peek (int row, int col);
#endif
-/* $Id: parser.c,v 1.19 2003/06/21 05:46:18 reinelt Exp $
+/* $Id: parser.c,v 1.20 2003/09/01 04:09:35 reinelt Exp $
*
* row definition parser
*
*
*
* $Log: parser.c,v $
+ * Revision 1.20 2003/09/01 04:09:35 reinelt
+ * icons nearly finished, but MatrixOrbital only
+ *
* Revision 1.19 2003/06/21 05:46:18 reinelt
* DVB client integrated
*
static SYMTAB Symtab[] = {{ "%", T_PERCENT, C_GENERIC, 0 },
{ "$", T_DOLLAR, C_GENERIC, 0 },
+ { "&", T_AMPERSAND, C_GENERIC, 0 },
{ "o", T_OS, C_GENERIC, 0 },
{ "v", T_RELEASE, C_GENERIC, 0 },
{ "p", T_CPU, C_GENERIC, 0 },
}
break;
+ case '&':
+ if (*(s+1)<'1'||*(s+1)>'9') {
+ s++;
+ error ("WARNING: illegal '&%c' in <%s>", *s, string);
+ } else {
+ *p++=*s++;
+ *p++=*s++;
+ }
+ break;
+
case '\\':
if (*(s+1)=='\\') {
*p++='\\';
-/* $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
*
*
*
* $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
*
#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,
-/* $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
*
*
*
* $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
*
*p++='\t';
}
+ } else if (*s=='&') {
+ lcd_icon(*(++s)-'0', row, p-buffer+1);
+ *p++='\t';
+
} else {
*p++=*s;
}