diff options
Diffstat (limited to '')
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.in | 34 | ||||
-rw-r--r-- | config.h.in | 3 | ||||
-rwxr-xr-x | configure | 17 | ||||
-rw-r--r-- | drivers.m4 | 13 | ||||
-rw-r--r-- | drv.c | 10 | ||||
-rw-r--r-- | drv_Crystalfontz.c | 7 | ||||
-rw-r--r-- | drv_LCDLinux.c | 11 | ||||
-rw-r--r-- | drv_SimpleLCD.c | 265 | ||||
-rw-r--r-- | drv_generic_text.c | 7 | ||||
-rw-r--r-- | lcd4linux.conf.sample | 7 |
11 files changed, 347 insertions, 28 deletions
diff --git a/Makefile.am b/Makefile.am index cf89cd2..7451fd0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -71,6 +71,7 @@ drv_MatrixOrbital.c \ drv_MilfordInstruments.c \ drv_NULL.c \ drv_RouterBoard.c \ +drv_SimpleLCD.c \ drv_T6963.c \ drv_USBLCD.c \ drv_X11.c \ diff --git a/Makefile.in b/Makefile.in index b64f8c6..afa50c1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -99,7 +99,7 @@ lcd4linux_SOURCES = lcd4linux.c cfg.c cfg.h deb #liblcd4linux_la_SOURCES = -EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h drv_BeckmannEgle.c drv_BWCT.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_LCDLinux.c drv_LCDTerm.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_NULL.c drv_RouterBoard.c drv_T6963.c drv_USBLCD.c drv_X11.c font_6x8.h plugin_apm.c plugin_cpuinfo.c plugin_diskstats.c plugin_dvb.c plugin_exec.c plugin_i2c_sensors.c plugin_imon.c plugin_isdn.c plugin_loadavg.c plugin_meminfo.c plugin_mysql.c plugin_netdev.c plugin_pop3.c plugin_ppp.c plugin_proc_stat.c plugin_seti.c plugin_uname.c plugin_uptime.c plugin_wireless.c plugin_xmms.c +EXTRA_lcd4linux_SOURCES = drv_generic_text.c drv_generic_text.h drv_generic_graphic.c drv_generic_graphic.h drv_generic_serial.c drv_generic_serial.h drv_generic_parport.c drv_generic_parport.h drv_BeckmannEgle.c drv_BWCT.c drv_Crystalfontz.c drv_Curses.c drv_Cwlinux.c drv_HD44780.c drv_Image.c drv_LCDLinux.c drv_LCDTerm.c drv_M50530.c drv_MatrixOrbital.c drv_MilfordInstruments.c drv_NULL.c drv_RouterBoard.c drv_SimpleLCD.c drv_T6963.c drv_USBLCD.c drv_X11.c font_6x8.h plugin_apm.c plugin_cpuinfo.c plugin_diskstats.c plugin_dvb.c plugin_exec.c plugin_i2c_sensors.c plugin_imon.c plugin_isdn.c plugin_loadavg.c plugin_meminfo.c plugin_mysql.c plugin_netdev.c plugin_pop3.c plugin_ppp.c plugin_proc_stat.c plugin_seti.c plugin_uname.c plugin_uptime.c plugin_wireless.c plugin_xmms.c EXTRA_DIST = lcd4linux.conf.sample lcd4kde.conf lcd4linux.kdelnk lcd4linux.xpm lcd4linux.lsm curses.m4 AUTHORS CREDITS FAQ NEWS TODO README README.Drivers README.Plugins README.KDE plugin_sample.c @@ -142,22 +142,22 @@ DEP_FILES = .deps/cfg.P .deps/debug.P .deps/drv.P .deps/drv_BWCT.P \ .deps/drv_Cwlinux.P .deps/drv_HD44780.P .deps/drv_Image.P \ .deps/drv_LCDLinux.P .deps/drv_LCDTerm.P .deps/drv_M50530.P \ .deps/drv_MatrixOrbital.P .deps/drv_MilfordInstruments.P \ -.deps/drv_NULL.P .deps/drv_RouterBoard.P .deps/drv_T6963.P \ -.deps/drv_USBLCD.P .deps/drv_X11.P .deps/drv_generic_graphic.P \ -.deps/drv_generic_parport.P .deps/drv_generic_serial.P \ -.deps/drv_generic_text.P .deps/evaluator.P .deps/hash.P .deps/layout.P \ -.deps/lcd4linux.P .deps/pid.P .deps/plugin.P .deps/plugin_apm.P \ -.deps/plugin_cfg.P .deps/plugin_cpuinfo.P .deps/plugin_diskstats.P \ -.deps/plugin_dvb.P .deps/plugin_exec.P .deps/plugin_i2c_sensors.P \ -.deps/plugin_imon.P .deps/plugin_isdn.P .deps/plugin_loadavg.P \ -.deps/plugin_math.P .deps/plugin_meminfo.P .deps/plugin_mysql.P \ -.deps/plugin_netdev.P .deps/plugin_pop3.P .deps/plugin_ppp.P \ -.deps/plugin_proc_stat.P .deps/plugin_seti.P .deps/plugin_string.P \ -.deps/plugin_test.P .deps/plugin_time.P .deps/plugin_uname.P \ -.deps/plugin_uptime.P .deps/plugin_wireless.P .deps/plugin_xmms.P \ -.deps/qprintf.P .deps/thread.P .deps/timer.P .deps/udelay.P \ -.deps/widget.P .deps/widget_bar.P .deps/widget_icon.P \ -.deps/widget_text.P +.deps/drv_NULL.P .deps/drv_RouterBoard.P .deps/drv_SimpleLCD.P \ +.deps/drv_T6963.P .deps/drv_USBLCD.P .deps/drv_X11.P \ +.deps/drv_generic_graphic.P .deps/drv_generic_parport.P \ +.deps/drv_generic_serial.P .deps/drv_generic_text.P .deps/evaluator.P \ +.deps/hash.P .deps/layout.P .deps/lcd4linux.P .deps/pid.P \ +.deps/plugin.P .deps/plugin_apm.P .deps/plugin_cfg.P \ +.deps/plugin_cpuinfo.P .deps/plugin_diskstats.P .deps/plugin_dvb.P \ +.deps/plugin_exec.P .deps/plugin_i2c_sensors.P .deps/plugin_imon.P \ +.deps/plugin_isdn.P .deps/plugin_loadavg.P .deps/plugin_math.P \ +.deps/plugin_meminfo.P .deps/plugin_mysql.P .deps/plugin_netdev.P \ +.deps/plugin_pop3.P .deps/plugin_ppp.P .deps/plugin_proc_stat.P \ +.deps/plugin_seti.P .deps/plugin_string.P .deps/plugin_test.P \ +.deps/plugin_time.P .deps/plugin_uname.P .deps/plugin_uptime.P \ +.deps/plugin_wireless.P .deps/plugin_xmms.P .deps/qprintf.P \ +.deps/thread.P .deps/timer.P .deps/udelay.P .deps/widget.P \ +.deps/widget_bar.P .deps/widget_icon.P .deps/widget_text.P SOURCES = $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES) OBJECTS = $(lcd4linux_OBJECTS) diff --git a/config.h.in b/config.h.in index 2ed609e..b122ecb 100644 --- a/config.h.in +++ b/config.h.in @@ -359,6 +359,9 @@ /* RouterBoard driver */ #undef WITH_ROUTERBOARD +/* SimpleLCD driver */ +#undef WITH_SIMPLELCD + /* T6963 driver */ #undef WITH_T6963 @@ -870,7 +870,7 @@ Optional Packages: BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, HD44780, LCDLinux, LCDTerm, M50530, MatrixOrbital, MilfordInstruments, NULL, PNG, PPM, RouterBoard, - T6963, USBLCD, X11 + SimpleLCD, T6963, USBLCD, X11 --with-plugins=<list> choose which plugins to compile. type --with-plugins=list for a list of avaible plugins @@ -5419,6 +5419,7 @@ for driver in $drivers; do T6963="yes" USBLCD="yes" X11="yes" + SIMPLELCD="yes" ;; BeckmannEgle) BECKMANNEGLE=$val @@ -5465,6 +5466,9 @@ for driver in $drivers; do RouterBoard) ROUTERBOARD=$val ;; + SimpleLCD) + SIMPLELCD=$val + ;; T6963) T6963=$val ;; @@ -5667,6 +5671,17 @@ _ACEOF fi +if test "$SIMPLELCD" = "yes"; then + TEXT="yes" + SERIAL="yes" + DRIVERS="$DRIVERS drv_SimpleLCD.o" + +cat >>confdefs.h <<\_ACEOF +#define WITH_SIMPLELCD 1 +_ACEOF + +fi + if test "$T6963" = "yes"; then GRAPHIC="yes" PARPORT="yes" @@ -31,7 +31,7 @@ AC_ARG_WITH( [ BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux,] [ HD44780, LCDLinux, LCDTerm, M50530, MatrixOrbital,] [ MilfordInstruments, NULL, PNG, PPM, RouterBoard,] - [ T6963, USBLCD, X11], + [ SimpleLCD, T6963, USBLCD, X11], drivers=$withval, drivers=all ) @@ -70,6 +70,7 @@ for driver in $drivers; do T6963="yes" USBLCD="yes" X11="yes" + SIMPLELCD="yes" ;; BeckmannEgle) BECKMANNEGLE=$val @@ -116,6 +117,9 @@ for driver in $drivers; do RouterBoard) ROUTERBOARD=$val ;; + SimpleLCD) + SIMPLELCD=$val + ;; T6963) T6963=$val ;; @@ -252,6 +256,13 @@ if test "$ROUTERBOARD" = "yes"; then AC_DEFINE(WITH_ROUTERBOARD,1,[RouterBoard driver]) fi +if test "$SIMPLELCD" = "yes"; then + TEXT="yes" + SERIAL="yes" + DRIVERS="$DRIVERS drv_SimpleLCD.o" + AC_DEFINE(WITH_SIMPLELCD,1,[SimpleLCD driver]) +fi + if test "$T6963" = "yes"; then GRAPHIC="yes" PARPORT="yes" @@ -1,4 +1,4 @@ -/* $Id: drv.c,v 1.27 2005/01/30 06:43:22 reinelt Exp $ +/* $Id: drv.c,v 1.28 2005/02/24 07:06:48 reinelt Exp $ * * new framework for display drivers * @@ -23,6 +23,9 @@ * * * $Log: drv.c,v $ + * Revision 1.28 2005/02/24 07:06:48 reinelt + * SimpleLCD driver added + * * Revision 1.27 2005/01/30 06:43:22 reinelt * driver for LCD-Linux finished * @@ -196,6 +199,7 @@ extern DRIVER drv_MatrixOrbital; extern DRIVER drv_MilfordInstruments; extern DRIVER drv_NULL; extern DRIVER drv_RouterBoard; +extern DRIVER drv_SimpleLCD; extern DRIVER drv_T6963; extern DRIVER drv_USBLCD; extern DRIVER drv_X11; @@ -249,6 +253,9 @@ DRIVER *Driver[] = { #ifdef WITH_ROUTERBOARD &drv_RouterBoard, #endif +#ifdef WITH_SIMPLELCD + &drv_SimpleLCD, +#endif #ifdef WITH_T6963 &drv_T6963, #endif @@ -258,6 +265,7 @@ DRIVER *Driver[] = { #ifdef WITH_X11 &drv_X11, #endif + NULL, }; diff --git a/drv_Crystalfontz.c b/drv_Crystalfontz.c index 6d5c31e..7bdd196 100644 --- a/drv_Crystalfontz.c +++ b/drv_Crystalfontz.c @@ -1,4 +1,4 @@ -/* $Id: drv_Crystalfontz.c,v 1.30 2005/01/18 06:30:22 reinelt Exp $ +/* $Id: drv_Crystalfontz.c,v 1.31 2005/02/24 07:06:48 reinelt Exp $ * * new style driver for Crystalfontz display modules * @@ -23,6 +23,9 @@ * * * $Log: drv_Crystalfontz.c,v $ + * Revision 1.31 2005/02/24 07:06:48 reinelt + * SimpleLCD driver added + * * Revision 1.30 2005/01/18 06:30:22 reinelt * added (C) to all copyright statements * @@ -986,7 +989,7 @@ int drv_CF_init (const char *section, const int quiet) break; case 2: CHAR0 = 0; /* ASCII of first user-defineable char */ - GOTO_COST = 999; /* there is no goto on 633 */ + GOTO_COST = -1; /* there is no goto on 633 */ drv_generic_text_real_write = drv_CF_write2; drv_generic_text_real_defchar = drv_CF_defchar23; break; diff --git a/drv_LCDLinux.c b/drv_LCDLinux.c index cf83f9c..fd78ac0 100644 --- a/drv_LCDLinux.c +++ b/drv_LCDLinux.c @@ -1,4 +1,4 @@ -/* $Id: drv_LCDLinux.c,v 1.3 2005/02/24 06:51:40 reinelt Exp $ +/* $Id: drv_LCDLinux.c,v 1.4 2005/02/24 07:06:48 reinelt Exp $ * * driver for the LCD-Linux HD44780 kernel driver * http://lcd-linux.sourceforge.net @@ -24,6 +24,9 @@ * * * $Log: drv_LCDLinux.c,v $ + * Revision 1.4 2005/02/24 07:06:48 reinelt + * SimpleLCD driver added + * * Revision 1.3 2005/02/24 06:51:40 reinelt * LCD-Linux driver GOTO_COST corrected * @@ -149,7 +152,7 @@ static void drv_LL_defchar (const int ascii, const unsigned char *matrix) } -static int drv_LL_start (const char *section, const int quiet) +static int drv_LL_start (const int quiet) { struct lcd_driver buf; @@ -230,7 +233,7 @@ int drv_LL_init (const char *section, const int quiet) YRES = 8; /* pixel height of one char */ CHARS = 8; /* number of user-defineable characters */ CHAR0 = 0; /* ASCII of first user-defineable char */ - GOTO_COST = 1; /* number of bytes a goto command requires */ + GOTO_COST = -1; /* number of bytes a goto command requires */ /* real worker functions */ drv_generic_text_real_write = drv_LL_write; @@ -238,7 +241,7 @@ int drv_LL_init (const char *section, const int quiet) /* start display */ - if ((ret=drv_LL_start (section, quiet))!=0) + if ((ret=drv_LL_start (quiet))!=0) return ret; /* initialize generic text driver */ diff --git a/drv_SimpleLCD.c b/drv_SimpleLCD.c new file mode 100644 index 0000000..85f91bf --- /dev/null +++ b/drv_SimpleLCD.c @@ -0,0 +1,265 @@ +/* $Id: drv_SimpleLCD.c,v 1.1 2005/02/24 07:06:48 reinelt Exp $ + * + * driver for a simple serial terminal. + * This driver simply send out caracters on the serial port, without any + * formatting instructions for a particular LCD device. + * This is useful for custom boards of for very simple LCD. + * + * I use it for tests on a custom-made board based on a AVR microcontroler + * and also for driver a Point-of-Sale text-only display. + * I assume the following : + * - CR (0x0d) Return to the begining of the line without erasing, + * - LF (0x0a) Initiate a new line (but without sending the cursor to + * the begining of the line) + * - BS (0x08) Erase the previous caracter on the line. + * - It's not possible to return to the first line. Thus a back buffer is used + * in this driver. + * + * The code come mostly taken from the LCDTerm driver in LCD4Linux, from + * Michaels Reinelt, many thanks to him. + * + * This driver is released under the GPL. + * + * Copyright (C) 2005 Julien Aube <ob@obconseil.net> + * Copyright (C) 2005 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net> + * + * This file is part of LCD4Linux. + * + * LCD4Linux is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * LCD4Linux is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Log: drv_SimpleLCD.c,v $ + * Revision 1.1 2005/02/24 07:06:48 reinelt + * SimpleLCD driver added + * + */ + +/* + * + * exported fuctions: + * + * struct DRIVER drv_SimpleLCD + * + */ + +#include "config.h" + +#include <stdlib.h> +#include <unistd.h> +#include <string.h> + +#include "debug.h" +#include "cfg.h" +#include "qprintf.h" +#include "plugin.h" +#include "widget.h" +#include "widget_text.h" +#include "widget_icon.h" +#include "widget_bar.h" +#include "drv.h" +#include "drv_generic_text.h" +#include "drv_generic_serial.h" + + +static char Name[]="SimpleLCD"; +static char *backbuffer=0; +static int backbuffer_size=0; + +/****************************************/ +/*** hardware dependant functions ***/ +/****************************************/ + +/** No clear function on SimpleLCD : Just send CR-LF * number of lines **/ +static void drv_SL_clear (void) +{ + char cmd[2] = { '\r', '\n' }; + int i; + for (i=0;i<DROWS;++i) { + drv_generic_serial_write (cmd, 2); + } + memset(backbuffer,' ',backbuffer_size); +} + +/* If full_commit = true, then the whole buffer is to be sent to screen. + if full_commit = false, then only the last line is to be sent (faster on slow screens) +*/ +static void drv_SL_commit(int full_commit) +{ + int row; + char cmd[2] = { '\r', '\n' }; + if (full_commit) { + for (row=0;row < DROWS; row++) { + drv_generic_serial_write (cmd, 2); + drv_generic_serial_write(backbuffer+(DCOLS*row),DCOLS); + } + } else { + drv_generic_serial_write (cmd, 1); /* Go to the beginning of the line only */ + drv_generic_serial_write(backbuffer+(DCOLS*(DROWS-1)),DCOLS); + } +} + +static void drv_SL_write (const int row, const int col, const char *data, int len) +{ + memcpy(backbuffer+(row*DCOLS)+col,data,len); + if (row == DROWS-1) + drv_SL_commit(0); + else + drv_SL_commit(1); +} + + + +static int drv_SL_start (const char *section, const int quiet) +{ + int rows=-1, cols=-1; + unsigned int flags=0; + char *s; + + cfg_number(section,"Options",0,0,0xffff,&flags); + + if (drv_generic_serial_open(section, Name, flags) < 0) return -1; + + s=cfg_get(section, "Size", NULL); + if (s==NULL || *s=='\0') { + error ("%s: no '%s.Size' entry from %s", Name, section, cfg_source()); + return -1; + } + if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) { + error ("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source()); + free (s); + return -1; + } + + DROWS = rows; + DCOLS = cols; + + backbuffer_size = DROWS * DCOLS; + backbuffer = malloc(backbuffer_size); + if ( ! backbuffer ){ + return -1; + } + drv_SL_clear(); /* clear */ + + + if (!quiet) { + char buffer[40]; + qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS); + if (drv_generic_text_greet (buffer, NULL)) { + sleep (3); + drv_SL_clear(); + } + } + + return 0; +} + + +/****************************************/ +/*** plugins ***/ +/****************************************/ + +/* none */ + + +/****************************************/ +/*** widget callbacks ***/ +/****************************************/ + + +/* using drv_generic_text_draw(W) */ + + +/****************************************/ +/*** exported functions ***/ +/****************************************/ + + +/* list models */ +int drv_SL_list (void) +{ + printf ("generic"); + return 0; +} + + +/* initialize driver & display */ +int drv_SL_init (const char *section, const int quiet) +{ + WIDGET_CLASS wc; + int ret; + + /* display preferences */ + XRES = 5; /* pixel width of one char */ + YRES = 8; /* pixel height of one char */ + CHARS = 0; /* number of user-defineable characters */ + CHAR0 = 0; /* ASCII of first user-defineable char */ + + GOTO_COST = -1; /* number of bytes a goto command requires */ + + /* real worker functions */ + drv_generic_text_real_write = drv_SL_write; + + + /* start display */ + if ((ret=drv_SL_start (section, quiet))!=0) + return ret; + + /* initialize generic text driver */ + if ((ret=drv_generic_text_init(section, Name))!=0) + return ret; + + /* register text widget */ + wc=Widget_Text; + wc.draw=drv_generic_text_draw; + widget_register(&wc); + + /* register plugins */ + /* none */ + + return 0; +} + + +/* close driver & display */ +int drv_SL_quit (const int quiet) +{ + + info("%s: shutting down.", Name); + + drv_generic_text_quit(); + + /* clear display */ + drv_SL_clear(); + + /* say goodbye... */ + if (!quiet) { + drv_generic_text_greet ("goodbye!", NULL); + } + + drv_generic_serial_close(); + + if ( backbuffer ) { + free(backbuffer) ; backbuffer=0; backbuffer_size=0; + } + return (0); +} + + +DRIVER drv_SimpleLCD = { + name: Name, + list: drv_SL_list, + init: drv_SL_init, + quit: drv_SL_quit, +}; + diff --git a/drv_generic_text.c b/drv_generic_text.c index 793d1a2..b1f6675 100644 --- a/drv_generic_text.c +++ b/drv_generic_text.c @@ -1,4 +1,4 @@ -/* $Id: drv_generic_text.c,v 1.24 2005/01/18 06:30:23 reinelt Exp $ +/* $Id: drv_generic_text.c,v 1.25 2005/02/24 07:06:48 reinelt Exp $ * * generic driver helper for text-based displays * @@ -23,6 +23,9 @@ * * * $Log: drv_generic_text.c,v $ + * Revision 1.25 2005/02/24 07:06:48 reinelt + * SimpleLCD driver added + * * Revision 1.24 2005/01/18 06:30:23 reinelt * added (C) to all copyright statements * @@ -431,7 +434,7 @@ int drv_generic_text_draw (WIDGET *W) if (fb1[col] == fb2[col]) { /* If we find just one equal byte, we don't break, because this */ /* would require a goto, which takes several bytes, too. */ - if (++equal > GOTO_COST) break; + if (GOTO_COST >= 0 && ++equal > GOTO_COST) break; } else { pos2 = col; equal = 0; diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample index 7c65fee..2a29036 100644 --- a/lcd4linux.conf.sample +++ b/lcd4linux.conf.sample @@ -165,6 +165,13 @@ Display LCDTerm { Icons 1 } +Display SimpleLCD { + Driver 'SimpleLCD' + Port '/dev/tts/0' + Speed 1200 + Options 0 + Size '20x2' +} Display M50530-24x8 { Driver 'M50530' |