From b8d041d37641f40b4a093fb0e712f6dbd12f662b Mon Sep 17 00:00:00 2001 From: reinelt Date: Thu, 24 Feb 2005 07:06:48 +0000 Subject: [lcd4linux @ 2005-02-24 07:06:45 by reinelt] SimpleLCD driver added git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@515 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- Makefile.am | 1 + Makefile.in | 34 +++---- config.h.in | 3 + configure | 17 +++- drivers.m4 | 13 ++- drv.c | 10 +- drv_Crystalfontz.c | 7 +- drv_LCDLinux.c | 11 ++- drv_SimpleLCD.c | 265 ++++++++++++++++++++++++++++++++++++++++++++++++++ drv_generic_text.c | 7 +- lcd4linux.conf.sample | 7 ++ 11 files changed, 347 insertions(+), 28 deletions(-) create mode 100644 drv_SimpleLCD.c 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 diff --git a/configure b/configure index e084bf6..f6a31d1 100755 --- a/configure +++ b/configure @@ -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= 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" diff --git a/drivers.m4 b/drivers.m4 index f98ac22..f012f3c 100644 --- a/drivers.m4 +++ b/drivers.m4 @@ -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" diff --git a/drv.c b/drv.c index 8575615..dcb85a8 100644 --- a/drv.c +++ b/drv.c @@ -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 + * Copyright (C) 2005 The LCD4Linux Team + * + * 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 +#include +#include + +#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 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' -- cgit v1.2.3