diff options
author | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-10-19 03:03:57 +0000 |
---|---|---|
committer | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-10-19 03:03:57 +0000 |
commit | 34fd00e7b751932b1739b165006be944fb0ecaed (patch) | |
tree | 60477c430ad618064bce9c11ec3396d9553f62e4 | |
parent | f848e286bd8dac72e6bdebf97333c4ad3a3a4891 (diff) | |
download | lcd4linux-34fd00e7b751932b1739b165006be944fb0ecaed.tar.gz |
driver for Logic Way GmbH ABP08 (serial) and ABP09 (USB) appliance control panels by Arndt Kritzner
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1046 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | config.h.in | 3 | ||||
-rwxr-xr-x | configure | 43 | ||||
-rw-r--r-- | drivers.m4 | 13 | ||||
-rw-r--r-- | drv.c | 4 | ||||
-rw-r--r-- | drv_LW_ABP.c | 343 | ||||
-rw-r--r-- | lcd4linux.conf.sample | 7 | ||||
-rwxr-xr-x | smoketest.sh | 2 |
9 files changed, 401 insertions, 17 deletions
diff --git a/Makefile.am b/Makefile.am index 475f5a8..8d3724a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -87,6 +87,7 @@ drv_LCDTerm.c \ drv_LEDMatrix.c \ drv_LPH7508.c \ drv_LUIse.c \ +drv_LW_ABP.c \ drv_M50530.c \ drv_MatrixOrbital.c \ drv_MatrixOrbitalGX.c \ diff --git a/Makefile.in b/Makefile.in index b61e452..9d11120 100644 --- a/Makefile.in +++ b/Makefile.in @@ -311,6 +311,7 @@ drv_LCDTerm.c \ drv_LEDMatrix.c \ drv_LPH7508.c \ drv_LUIse.c \ +drv_LW_ABP.c \ drv_M50530.c \ drv_MatrixOrbital.c \ drv_MatrixOrbitalGX.c \ @@ -527,6 +528,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LEDMatrix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LPH7508.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LUIse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_LW_ABP.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_M50530.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_MatrixOrbital.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_MatrixOrbitalGX.Po@am__quote@ diff --git a/config.h.in b/config.h.in index c5a88b5..3ae5d42 100644 --- a/config.h.in +++ b/config.h.in @@ -510,6 +510,9 @@ /* LUIse driver */ #undef WITH_LUISE +/* LW ABP driver */ +#undef WITH_LW_ABP + /* M50530 driver */ #undef WITH_M50530 @@ -1556,7 +1556,7 @@ Optional Packages: possible drivers are: BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D, G15, GLCD2USB, HD44780, IRLCD, LCD2USB, LCDLinux, LCDTerm, - LPH7508, LUIse, M50530, MatrixOrbital, MilfordInstruments, + LPH7508, LUIse, LW_ABP, M50530, MatrixOrbital, MilfordInstruments, Noritake, NULL, PNG, PPM, Pertelian, PHAnderson, picoLCD, picoLCDGraphic, RouterBoard, Sample, serdisplib, ShuttleVFD, SimpleLCD, st2205, T6963, Trefon, ULA200, USBLCD, USBHUB, @@ -6183,6 +6183,7 @@ for driver in $drivers; do LEDMATRIX="yes" LPH7508="yes" LUISE="yes" + LW_ABP="yes" M50530="yes" MATRIXORBITAL="yes" MATRIXORBITALGX="yes" @@ -6264,6 +6265,9 @@ for driver in $drivers; do LUIse) LUISE=$val ;; + LW_ABP) + LW_ABP=$val + ;; M50530) M50530=$val ;; @@ -6586,6 +6590,15 @@ $as_echo "$as_me: WARNING: luise.h not found: LUIse driver disabled" >&2;} fi fi +if test "$LW_ABP" = "yes"; then + TEXT="yes" + SERIAL="yes" + DRIVERS="$DRIVERS drv_LW_ABP.o" + +$as_echo "#define WITH_LW_ABP 1" >>confdefs.h + +fi + if test "$M50530" = "yes"; then TEXT="yes" GPIO="yes" @@ -12140,13 +12153,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:12143: $ac_compile\"" >&5) + (eval echo "\"\$as_me:12156: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:12146: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:12159: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:12149: output\"" >&5) + (eval echo "\"\$as_me:12162: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -13340,7 +13353,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 13343 "configure"' > conftest.$ac_ext + echo '#line 13356 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14598,11 +14611,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14601: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14614: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14605: \$? = $ac_status" >&5 + echo "$as_me:14618: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14937,11 +14950,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14940: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14953: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14944: \$? = $ac_status" >&5 + echo "$as_me:14957: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15042,11 +15055,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15045: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15058: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15049: \$? = $ac_status" >&5 + echo "$as_me:15062: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15097,11 +15110,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15100: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15113: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15104: \$? = $ac_status" >&5 + echo "$as_me:15117: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17480,7 +17493,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17483 "configure" +#line 17496 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17576,7 +17589,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17579 "configure" +#line 17592 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -34,7 +34,7 @@ AC_ARG_WITH( [ possible drivers are:] [ BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D,] [ G15, GLCD2USB, HD44780, IRLCD, LCD2USB, LCDLinux, LCDTerm,] - [ LPH7508, LUIse, M50530, MatrixOrbital, MilfordInstruments,] + [ LPH7508, LUIse, LW_ABP, M50530, MatrixOrbital, MilfordInstruments,] [ Noritake, NULL, PNG, PPM, Pertelian, PHAnderson, picoLCD,] [ picoLCDGraphic, RouterBoard, Sample, serdisplib, ShuttleVFD,] [ SimpleLCD, st2205, T6963, Trefon, ULA200, USBLCD, USBHUB,] @@ -76,6 +76,7 @@ for driver in $drivers; do LEDMATRIX="yes" LPH7508="yes" LUISE="yes" + LW_ABP="yes" M50530="yes" MATRIXORBITAL="yes" MATRIXORBITALGX="yes" @@ -157,6 +158,9 @@ for driver in $drivers; do LUIse) LUISE=$val ;; + LW_ABP) + LW_ABP=$val + ;; M50530) M50530=$val ;; @@ -434,6 +438,13 @@ if test "$LUISE" = "yes"; then fi fi +if test "$LW_ABP" = "yes"; then + TEXT="yes" + SERIAL="yes" + DRIVERS="$DRIVERS drv_LW_ABP.o" + AC_DEFINE(WITH_LW_ABP,1,[LW ABP driver]) +fi + if test "$M50530" = "yes"; then TEXT="yes" GPIO="yes" @@ -65,6 +65,7 @@ extern DRIVER drv_LCDTerm; extern DRIVER drv_LEDMatrix; extern DRIVER drv_LPH7508; extern DRIVER drv_LUIse; +extern DRIVER drv_LW_ABP; extern DRIVER drv_M50530; extern DRIVER drv_MatrixOrbital; extern DRIVER drv_MilfordInstruments; @@ -150,6 +151,9 @@ DRIVER *Driver[] = { #ifdef WITH_LUISE &drv_LUIse, #endif +#ifdef WITH_LW_ABP + &drv_LW_ABP, +#endif #ifdef WITH_M50530 &drv_M50530, #endif diff --git a/drv_LW_ABP.c b/drv_LW_ABP.c new file mode 100644 index 0000000..e876f0c --- /dev/null +++ b/drv_LW_ABP.c @@ -0,0 +1,343 @@ +/* $Id$ + * $URL$ + * + * driver for Logic Way GmbH ABP08 (serial) and ABP09 (USB) appliance control panels + * http://www.logicway.de/pages/mde-hardware.shtml#ABP.AMC + * + * Copyright (C) 2009 Arndt Kritzner <kritzner@logicway.de> + * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at> + * Copyright (C) 2005, 2006, 2007, 2009 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. + * + */ + +/* + * + * exported fuctions: + * + * struct DRIVER drv_LW_ABP + * + */ + +#include "config.h" + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include "debug.h" +#include "cfg.h" +#include "qprintf.h" +#include "udelay.h" +#include "plugin.h" +#include "widget.h" +#include "widget_text.h" +#include "widget_icon.h" +#include "widget_bar.h" +#include "drv.h" + +/* text mode display? */ +#include "drv_generic_text.h" + +/* serial port? */ +#include "drv_generic_serial.h" + +/* i2c bus? */ +#ifdef WITH_I2C +#include "drv_generic_i2c.h" +#endif + + +static char Name[] = "LW_ABP"; + + +/****************************************/ +/*** hardware dependant functions ***/ +/****************************************/ + +static int drv_LW_ABP_open(const char *section) +{ + /* open serial port */ + /* don't mind about device, speed and stuff, this function will take care of */ + + if (drv_generic_serial_open(section, Name, 0) < 0) + return -1; + + return 0; +} + + +static int drv_LW_ABP_close(void) +{ + drv_generic_serial_close(); + + return 0; +} + + +/* dummy function that sends something to the display */ +static void drv_LW_ABP_send(const char *data, const unsigned int len) +{ + /* send data to the serial port is easy... */ + drv_generic_serial_write(data, len); +} + + +/* text mode displays only */ +static void drv_LW_ABP_clear(void) +{ + char cmd[] = "lcd init\r\n"; + + /* do whatever is necessary to clear the display */ + drv_LW_ABP_send(cmd, strlen(cmd)); +} + + +/* text mode displays only */ +static void drv_LW_ABP_write(const int row, const int col, const char *data, int len) +{ + char cmd[] = "lcd set line "; + char row_[5]; + char col_[5]; + + /* do the cursor positioning here */ + drv_LW_ABP_send(cmd, strlen(cmd)); + sprintf(row_, "%d", row + 1); + drv_LW_ABP_send(row_, strlen(row_)); + if (col > 0) { + drv_LW_ABP_send(",", 1); + sprintf(col_, "%d", col + 1); + drv_LW_ABP_send(col_, strlen(col_)); + } + drv_LW_ABP_send(" ", 1); + + /* send string to the display */ + drv_LW_ABP_send(data, len); + drv_LW_ABP_send("\r\n", 2); + +} + +/* text mode displays only */ +static void drv_LW_ABP_defchar(const int ascii, const unsigned char *matrix) +{ +} + +/* example function used in a plugin */ +static int drv_LW_ABP_contrast(int contrast) +{ + char cmd[2]; + + /* adjust limits according to the display */ + if (contrast < 0) + contrast = 0; + if (contrast > 255) + contrast = 255; + + /* call a 'contrast' function */ + /* assume 0x04 to be the 'set contrast' command */ + cmd[0] = 0x04; + cmd[1] = contrast; + drv_LW_ABP_send(cmd, 2); + + return contrast; +} + + +/* start text mode display */ +static int drv_LW_ABP_start(const char *section) +{ + int contrast; + int rows = -1, cols = -1; + char *s; + char cmd[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; + + /* open communication with the display */ + if (drv_LW_ABP_open(section) < 0) { + return -1; + } + + /* reset & initialize display */ + /* assume 0x00 to be a 'reset' command */ + cmd[0] = 0x00; + drv_LW_ABP_send(cmd, 0); + + if (cfg_number(section, "Contrast", 0, 0, 255, &contrast) > 0) { + drv_LW_ABP_contrast(contrast); + } + + drv_LW_ABP_clear(); /* clear display */ + + return 0; +} + +/****************************************/ +/*** plugins ***/ +/****************************************/ + +static void plugin_contrast(RESULT * result, RESULT * arg1) +{ + double contrast; + + contrast = drv_LW_ABP_contrast(R2N(arg1)); + SetResult(&result, R_NUMBER, &contrast); +} + + +/****************************************/ +/*** widget callbacks ***/ +/****************************************/ + + +/* using drv_generic_text_draw(W) */ +/* using drv_generic_text_icon_draw(W) */ +/* using drv_generic_text_bar_draw(W) */ +/* using drv_generic_gpio_draw(W) */ + + +/****************************************/ +/*** exported functions ***/ +/****************************************/ + + +/* list models */ +int drv_LW_ABP_list(void) +{ + printf("Logic Way ABP driver"); + return 0; +} + + +/* initialize driver & display */ +/* use this function for a text display */ +int drv_LW_ABP_init(const char *section, const int quiet) +{ + WIDGET_CLASS wc; + int ret; + + info("%s: %s", Name, "$Rev$"); + + /* 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 = 10; /* number of bytes a goto command requires */ + + /* real worker functions */ + drv_generic_text_real_write = drv_LW_ABP_write; + drv_generic_text_real_defchar = drv_LW_ABP_defchar; + + /* start display */ + if ((ret = drv_LW_ABP_start(section)) != 0) + return ret; + + if (!quiet) { + char buffer[40]; + qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS); + if (drv_generic_text_greet(buffer, "www.logicway.de")) { + sleep(3); + drv_LW_ABP_clear(); + } + } + + /* initialize generic text driver */ + if ((ret = drv_generic_text_init(section, Name)) != 0) + return ret; + + /* initialize generic icon driver */ + if ((ret = drv_generic_text_icon_init()) != 0) + return ret; + + /* initialize generic bar driver */ + if ((ret = drv_generic_text_bar_init(0)) != 0) + return ret; + + /* add fixed chars to the bar driver */ + drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */ + + + /* register text widget */ + wc = Widget_Text; + wc.draw = drv_generic_text_draw; + widget_register(&wc); + + /* register icon widget */ + wc = Widget_Icon; + wc.draw = drv_generic_text_icon_draw; + widget_register(&wc); + + /* register bar widget */ + wc = Widget_Bar; + wc.draw = drv_generic_text_bar_draw; + widget_register(&wc); + + /* register plugins */ + AddFunction("LCD::contrast", 1, plugin_contrast); + + return 0; +} + + + +/* close driver & display */ +/* use this function for a text display */ +int drv_LW_ABP_quit(const int quiet) +{ + + info("%s: shutting down.", Name); + + drv_generic_text_quit(); + + /* clear display */ + drv_LW_ABP_clear(); + + /* say goodbye... */ + if (!quiet) { + drv_generic_text_greet("goodbye!", NULL); + } + + debug("closing connection"); + drv_LW_ABP_close(); + + return (0); +} + + +/* use this one for a text display */ +DRIVER drv_LW_ABP = { + .name = Name, + .list = drv_LW_ABP_list, + .init = drv_LW_ABP_init, + .quit = drv_LW_ABP_quit, +}; diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample index 665d179..d6d2ab1 100644 --- a/lcd4linux.conf.sample +++ b/lcd4linux.conf.sample @@ -59,6 +59,13 @@ Display GLCD2USB { Driver 'GLCD2USB' } +Display ABP08-16x3 { + Driver 'LW_ABP' + Port '/dev/tts/0' + Speed 19200 + Size '16x3' +} + Display LCD2041 { Driver 'MatrixOrbital' Model 'LCD2041' diff --git a/smoketest.sh b/smoketest.sh index 30b162b..37de78a 100755 --- a/smoketest.sh +++ b/smoketest.sh @@ -9,7 +9,7 @@ rm -f smoketest.log lcd4linux make distclean ./bootstrap -for driver in BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D EA232graphic G15 GLCD2USB HD44780 IRLCD LCD2USB LCDLinux LCDTerm LEDMatrix LPH7508 LUIse M50530 MatrixOrbital MatrixOrbitalGX MilfordInstruments Noritake NULL Pertelian PHAnderson picoLCD picoLCDGraphic PNG PPM RouterBoard Sample serdisplib SimpleLCD T6963 Trefon ULA200 USBHUB USBLCD WincorNixdorf X11; do +for driver in BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D EA232graphic G15 GLCD2USB HD44780 IRLCD LCD2USB LCDLinux LCDTerm LEDMatrix LPH7508 LUIse LW_ABP M50530 MatrixOrbital MatrixOrbitalGX MilfordInstruments Noritake NULL Pertelian PHAnderson picoLCD picoLCDGraphic PNG PPM RouterBoard Sample serdisplib SimpleLCD T6963 Trefon ULA200 USBHUB USBLCD WincorNixdorf X11; do make distclean ./configure --with-drivers=$driver |