From b39a42b909dfb1c174044cf977d272f94445b18e Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Tue, 9 Sep 2003 05:30:34 +0000 Subject: [lcd4linux @ 2003-09-09 05:30:33 by reinelt] even more icons stuff --- USBLCD.c | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'USBLCD.c') diff --git a/USBLCD.c b/USBLCD.c index a3871aa..54a0c02 100644 --- a/USBLCD.c +++ b/USBLCD.c @@ -1,4 +1,4 @@ -/* $Id: USBLCD.c,v 1.12 2003/08/24 05:17:58 reinelt Exp $ +/* $Id: USBLCD.c,v 1.13 2003/09/09 05:30:34 reinelt Exp $ * * Driver for USBLCD ( see http://www.usblcd.de ) * This Driver is based on HD44780.c @@ -22,6 +22,9 @@ * * * $Log: USBLCD.c,v $ + * Revision 1.13 2003/09/09 05:30:34 reinelt + * even more icons stuff + * * Revision 1.12 2003/08/24 05:17:58 reinelt * liblcd4linux patch from Patrick Schemitz * @@ -90,6 +93,7 @@ #include "debug.h" #include "cfg.h" #include "display.h" +#include "icon.h" #include "bar.h" #define GET_HARD_VERSION 1 @@ -102,6 +106,7 @@ static LCD Lcd; static char *Port=NULL; static int usblcd_file; +static int Icons; static char *FrameBuffer1=NULL; static char *FrameBuffer2=NULL; @@ -203,6 +208,8 @@ int USBLCD_clear (int full) { memset (FrameBuffer1, ' ', Lcd.rows*Lcd.cols*sizeof(char)); + + icon_clear(); bar_clear(); if (full) { @@ -217,7 +224,7 @@ int USBLCD_clear (int full) int USBLCD_init (LCD *Self) { int rows=-1, cols=-1 ; - char *port,*s ; + char *port, *s, *e; if (Port) { free(Port); @@ -268,7 +275,21 @@ int USBLCD_init (LCD *Self) if (USBLCD_open()!=0) return -1; - bar_init(rows, cols, XRES, YRES, CHARS); + s=cfg_get("Icons", "0"); + Icons=strtol(s, &e, 0); + if (*e!='\0' || Icons<0 || Icons>8) { + debug ("Icons=%d e=<%s>", Icons, e); + error ("USBLCD: bad Icons '%s' in %s, must be between 0 and 8", s, cfg_source()); + return -1; + } + if (Icons>0) { + info ("reserving %d of %d user-defined characters for icons", Icons, CHARS); + icon_init(Lcd.rows, Lcd.cols, XRES, YRES, CHARS, Icons, USBLCD_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 @@ -304,11 +325,18 @@ int USBLCD_bar (int type, int row, int col, int max, int len1, int len2) } +int USBLCD_icon (int num, int seq, int row, int col) +{ + return icon_draw (num, seq, row, col); +} + + int USBLCD_flush (void) { int row, col, pos1, pos2; int c, equal; - + static int junk=0; //Fixme + bar_process(USBLCD_define_char); for (row=0; row