aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-04-09 14:17:50 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-04-09 14:17:50 +0000
commit44e13547adb794928f1cb2247c7cc038af07c924 (patch)
treeea7a12e5e2503780f06b20529df3efd36197ea08
parent117610a1811776aee9b98b9d9ac3427389375ca5 (diff)
downloadlcd4linux-44e13547adb794928f1cb2247c7cc038af07c924.tar.gz
[lcd4linux @ 2006-04-09 14:17:49 by reinelt]
autoconf/library fixes, image and graphic display inversion git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@655 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rwxr-xr-xconfigure32
-rw-r--r--drivers.m432
-rw-r--r--drv_LCD2USB.c22
-rw-r--r--drv_LUIse.c11
-rw-r--r--drv_generic_graphic.c27
-rw-r--r--lcd4linux.conf.sample22
-rw-r--r--widget_image.c49
-rw-r--r--widget_image.h10
8 files changed, 129 insertions, 76 deletions
diff --git a/configure b/configure
index fd44593..d4cf0e1 100755
--- a/configure
+++ b/configure
@@ -6315,7 +6315,6 @@ echo "${ECHO_T}done" >&6
TEXT="no"
GRAPHIC="no"
GPIO="no"
-IMAGE="no"
# generiv I/O drivers
PARPORT="no"
@@ -6323,6 +6322,8 @@ SERIAL="no"
I2C="no"
KEYPAD="no"
+# generic libraries
+LIBUSB="no"
if test "$BECKMANNEGLE" = "yes"; then
TEXT="yes"
@@ -6340,7 +6341,7 @@ if test "$BWCT" = "yes"; then
if test "$has_usb" = "true"; then
TEXT="yes"
DRIVERS="$DRIVERS drv_BWCT.o"
- DRVLIBS="$DRVLIBS -lusb"
+ LIBUSB="yes"
cat >>confdefs.h <<\_ACEOF
#define WITH_BWCT 1
@@ -6397,8 +6398,8 @@ fi
if test "$G15" = "yes"; then
if test "$has_usb" = "true"; then
GRAPHIC="yes"
+ LIBUSB="yes"
DRIVERS="$DRIVERS drv_G15.o"
- DRVLIBS="$DRVLIBS -lusb"
cat >>confdefs.h <<\_ACEOF
#define WITH_G15 1
@@ -6428,7 +6429,7 @@ if test "$LCD2USB" = "yes"; then
TEXT="yes"
SERIAL="yes"
DRIVERS="$DRIVERS drv_LCD2USB.o"
- DRVLIBS="$DRVLIBS -lusb"
+ LIBUSB="yes"
cat >>confdefs.h <<\_ACEOF
#define WITH_LCD2USB 1
@@ -6553,8 +6554,6 @@ fi
if test "$PNG" = "yes"; then
if test "$has_gd" = "true"; then
GRAPHIC="yes"
- IMAGE="yes"
- DRVLIBS="$DRVLIBS -lgd"
cat >>confdefs.h <<\_ACEOF
#define WITH_PNG 1
@@ -6568,7 +6567,6 @@ fi
if test "$PPM" = "yes"; then
GRAPHIC="yes"
- IMAGE="yes"
cat >>confdefs.h <<\_ACEOF
#define WITH_PPM 1
@@ -6576,10 +6574,6 @@ _ACEOF
fi
-if test "$IMAGE" = "yes"; then
- DRIVERS="$DRIVERS drv_Image.o"
-fi
-
if test "$ROUTERBOARD" = "yes"; then
TEXT="yes"
GPIO="yes"
@@ -6619,6 +6613,9 @@ cat >>confdefs.h <<\_ACEOF
#define WITH_SERDISPLIB 1
_ACEOF
+ if test "$has_usb" = "true"; then
+ LIBUSB="yes"
+ fi
else
{ echo "$as_me:$LINENO: WARNING: serdisp.h not found: serdisplib driver disabled" >&5
echo "$as_me: WARNING: serdisp.h not found: serdisplib driver disabled" >&2;}
@@ -6651,7 +6648,7 @@ if test "$Trefon" = "yes"; then
if test "$has_usb" = "true"; then
TEXT="yes"
DRIVERS="$DRIVERS drv_Trefon.o"
- DRVLIBS="$DRVLIBS -lusb"
+ LIBUSB="yes"
cat >>confdefs.h <<\_ACEOF
#define WITH_TREFON 1
@@ -6668,7 +6665,7 @@ if test "$USBLCD" = "yes"; then
SERIAL="yes"
DRIVERS="$DRIVERS drv_USBLCD.o"
if test "$has_usb" = "true"; then
- DRVLIBS="$DRVLIBS -lusb"
+ LIBUSB="yes"
fi
cat >>confdefs.h <<\_ACEOF
@@ -6721,6 +6718,10 @@ fi
# generic graphic driver
if test "$GRAPHIC" = "yes"; then
DRIVERS="$DRIVERS drv_generic_graphic.o"
+ if test "$has_gd" = "true"; then
+ DRIVERS="$DRIVERS drv_Image.o"
+ DRVLIBS="$DRVLIBS -lgd"
+ fi
fi
# generic GPIO driver
@@ -6753,6 +6754,11 @@ if test "$KEYPAD" = "yes"; then
DRIVERS="$DRIVERS drv_generic_keypad.o"
fi
+# libusb
+if test "$LIBUSB" = "yes"; then
+ DRVLIBS="$DRVLIBS -lusb"
+fi
+
diff --git a/drivers.m4 b/drivers.m4
index 5888051..0687160 100644
--- a/drivers.m4
+++ b/drivers.m4
@@ -180,7 +180,6 @@ AC_MSG_RESULT([done])
TEXT="no"
GRAPHIC="no"
GPIO="no"
-IMAGE="no"
# generiv I/O drivers
PARPORT="no"
@@ -188,6 +187,8 @@ SERIAL="no"
I2C="no"
KEYPAD="no"
+# generic libraries
+LIBUSB="no"
if test "$BECKMANNEGLE" = "yes"; then
TEXT="yes"
@@ -201,7 +202,7 @@ if test "$BWCT" = "yes"; then
if test "$has_usb" = "true"; then
TEXT="yes"
DRIVERS="$DRIVERS drv_BWCT.o"
- DRVLIBS="$DRVLIBS -lusb"
+ LIBUSB="yes"
AC_DEFINE(WITH_BWCT,1,[BWCT driver])
else
AC_MSG_WARN(usb.h not found: BWCT driver disabled)
@@ -240,8 +241,8 @@ fi
if test "$G15" = "yes"; then
if test "$has_usb" = "true"; then
GRAPHIC="yes"
+ LIBUSB="yes"
DRIVERS="$DRIVERS drv_G15.o"
- DRVLIBS="$DRVLIBS -lusb"
AC_DEFINE(WITH_G15,1,[G-15 driver])
else
AC_MSG_WARN(usb.h not found: G15 driver disabled)
@@ -262,7 +263,7 @@ if test "$LCD2USB" = "yes"; then
TEXT="yes"
SERIAL="yes"
DRIVERS="$DRIVERS drv_LCD2USB.o"
- DRVLIBS="$DRVLIBS -lusb"
+ LIBUSB="yes"
AC_DEFINE(WITH_LCD2USB,1,[LCD2USB driver])
else
AC_MSG_WARN(usb.h not found: LCD2USB driver disabled)
@@ -344,8 +345,6 @@ fi
if test "$PNG" = "yes"; then
if test "$has_gd" = "true"; then
GRAPHIC="yes"
- IMAGE="yes"
- DRVLIBS="$DRVLIBS -lgd"
AC_DEFINE(WITH_PNG,1,[ driver])
else
AC_MSG_WARN(gd.h not found: PNG driver disabled)
@@ -354,14 +353,9 @@ fi
if test "$PPM" = "yes"; then
GRAPHIC="yes"
- IMAGE="yes"
AC_DEFINE(WITH_PPM,1,[ driver])
fi
-if test "$IMAGE" = "yes"; then
- DRIVERS="$DRIVERS drv_Image.o"
-fi
-
if test "$ROUTERBOARD" = "yes"; then
TEXT="yes"
GPIO="yes"
@@ -389,6 +383,9 @@ if test "$SERDISPLIB" = "yes"; then
DRIVERS="$DRIVERS drv_serdisplib.o"
DRVLIBS="$DRVLIBS -L/usr/local/lib -lserdisp"
AC_DEFINE(WITH_SERDISPLIB,1,[serdisplib driver])
+ if test "$has_usb" = "true"; then
+ LIBUSB="yes"
+ fi
else
AC_MSG_WARN(serdisp.h not found: serdisplib driver disabled)
fi
@@ -412,7 +409,7 @@ if test "$Trefon" = "yes"; then
if test "$has_usb" = "true"; then
TEXT="yes"
DRIVERS="$DRIVERS drv_Trefon.o"
- DRVLIBS="$DRVLIBS -lusb"
+ LIBUSB="yes"
AC_DEFINE(WITH_TREFON,1,[TREFON driver])
else
AC_MSG_WARN(usb.h not found: Trefon driver disabled)
@@ -424,7 +421,7 @@ if test "$USBLCD" = "yes"; then
SERIAL="yes"
DRIVERS="$DRIVERS drv_USBLCD.o"
if test "$has_usb" = "true"; then
- DRVLIBS="$DRVLIBS -lusb"
+ LIBUSB="yes"
fi
AC_DEFINE(WITH_USBLCD,1,[USBLCD driver])
fi
@@ -462,6 +459,10 @@ fi
# generic graphic driver
if test "$GRAPHIC" = "yes"; then
DRIVERS="$DRIVERS drv_generic_graphic.o"
+ if test "$has_gd" = "true"; then
+ DRIVERS="$DRIVERS drv_Image.o"
+ DRVLIBS="$DRVLIBS -lgd"
+ fi
fi
# generic GPIO driver
@@ -490,5 +491,10 @@ if test "$KEYPAD" = "yes"; then
DRIVERS="$DRIVERS drv_generic_keypad.o"
fi
+# libusb
+if test "$LIBUSB" = "yes"; then
+ DRVLIBS="$DRVLIBS -lusb"
+fi
+
AC_SUBST(DRIVERS)
AC_SUBST(DRVLIBS)
diff --git a/drv_LCD2USB.c b/drv_LCD2USB.c
index 98ec9a6..fd48c2e 100644
--- a/drv_LCD2USB.c
+++ b/drv_LCD2USB.c
@@ -1,4 +1,4 @@
-/* $Id: drv_LCD2USB.c,v 1.9 2006/03/18 14:54:36 harbaum Exp $
+/* $Id: drv_LCD2USB.c,v 1.10 2006/04/09 14:17:50 reinelt Exp $
*
* driver for USB2LCD display interface
* see http://www.harbaum.org/till/lcd2usb for schematics
@@ -24,6 +24,9 @@
*
*
* $Log: drv_LCD2USB.c,v $
+ * Revision 1.10 2006/04/09 14:17:50 reinelt
+ * autoconf/library fixes, image and graphic display inversion
+ *
* Revision 1.9 2006/03/18 14:54:36 harbaum
* Improved USB error recovery
*
@@ -199,19 +202,18 @@ static int drv_L2U_send(int request, int value, int index)
// try to close and reopen connection
if (drv_L2U_open(bus_id, device_id) < 0) {
- error("%s: could not re-detect LCD2USB USB LCD", Name);
- got_signal = -1;
- return -1;
+ error("%s: could not re-detect LCD2USB USB LCD", Name);
+ got_signal = -1;
+ return -1;
}
-
// and try to re-send command
if (usb_control_msg(lcd, USB_TYPE_VENDOR, request, value, index, NULL, 0, 1000) < 0) {
- error("%s: retried USB request failed, aborting!", Name);
- got_signal = -1;
- return -1;
+ error("%s: retried USB request failed, aborting!", Name);
+ got_signal = -1;
+ return -1;
}
- info("%s: Device successfully reconnected.", Name);
+ info("%s: Device successfully reconnected.", Name);
}
return 0;
@@ -611,7 +613,7 @@ int drv_L2U_init(const char *section, const int quiet)
int asc255bug;
int ret;
- info("%s: %s", Name, "$Revision: 1.9 $");
+ info("%s: %s", Name, "$Revision: 1.10 $");
/* display preferences */
XRES = 5; /* pixel width of one char */
diff --git a/drv_LUIse.c b/drv_LUIse.c
index af88006..e25e933 100644
--- a/drv_LUIse.c
+++ b/drv_LUIse.c
@@ -1,4 +1,4 @@
-/* $Id: drv_LUIse.c,v 1.5 2006/03/10 18:06:52 tooly-bln Exp $
+/* $Id: drv_LUIse.c,v 1.6 2006/04/09 14:17:50 reinelt Exp $
*
* LUIse lcd4linux driver
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv_LUIse.c,v $
+ * Revision 1.6 2006/04/09 14:17:50 reinelt
+ * autoconf/library fixes, image and graphic display inversion
+ *
* Revision 1.5 2006/03/10 18:06:52 tooly-bln
* replace drv_generic_graphic_FB with drv_generic_graphic_black
*
@@ -98,11 +101,11 @@ static void drv_LUIse_blit(const int row, const int col, const int height, const
for (r = row; r < row + height; r++) {
for (c = col; c < col + width; c++) {
- if (drv_generic_graphic_black(r,c)) {
+ if (drv_generic_graphic_black(r, c)) {
LUI_SetPixel(devNum, 0, c, r, 1);
} else {
LUI_SetPixel(devNum, 0, c, r, 0);
- }
+ }
}
}
}
@@ -286,7 +289,7 @@ int drv_LUIse_init(const char *section, const int quiet)
{
int ret;
- info("%s: %s", Name, "$Revision: 1.5 $");
+ info("%s: %s", Name, "$Revision: 1.6 $");
/* real worker functions */
drv_generic_graphic_real_blit = drv_LUIse_blit;
diff --git a/drv_generic_graphic.c b/drv_generic_graphic.c
index e56401f..be41cee 100644
--- a/drv_generic_graphic.c
+++ b/drv_generic_graphic.c
@@ -23,6 +23,9 @@
*
*
* $Log: drv_generic_graphic.c,v $
+ * Revision 1.26 2006/04/09 14:17:50 reinelt
+ * autoconf/library fixes, image and graphic display inversion
+ *
* Revision 1.25 2006/02/27 07:53:52 reinelt
* some more graphic issues fixed
*
@@ -184,11 +187,16 @@ RGBA NO_COL = { R: 0x00, G: 0x00, B: 0x00, A:0x00 };
static char *Section = NULL;
static char *Driver = NULL;
-static int LROWS = 0; /* layout size (pixels!) */
-static int LCOLS = 0; /* layout size (pixels!) */
+/* layout size (pixels!) */
+static int LROWS = 0;
+static int LCOLS = 0;
+/* framebuffer */
static RGBA *drv_generic_graphic_FB[LAYERS] = { NULL, };
+/* inverted colors */
+static int INVERTED = 0;
+
/* must be implemented by the real driver */
void (*drv_generic_graphic_real_blit) () = NULL;
@@ -261,6 +269,12 @@ static RGBA drv_generic_graphic_blend(const int row, const int col)
ret.B = (p.B * p.A + ret.B * (255 - p.A)) / 255;
}
}
+ if (INVERTED) {
+ ret.R = 255 - ret.R;
+ ret.G = 255 - ret.G;
+ ret.B = 255 - ret.B;
+ }
+
return ret;
}
@@ -649,6 +663,9 @@ int drv_generic_graphic_init(const char *section, const char *driver)
if (color)
free(color);
+ /* inverted display? */
+ cfg_number(section, "inverted", 0, 0, 1, &INVERTED);
+
/* register text widget */
wc = Widget_Text;
wc.draw = drv_generic_graphic_draw;
@@ -705,11 +722,7 @@ unsigned char drv_generic_graphic_gray(const int row, const int col)
unsigned char drv_generic_graphic_black(const int row, const int col)
{
- RGBA p = drv_generic_graphic_blend(row, col);
- if (p.R > 127 || p.G > 127 || p.B > 127) {
- return 0;
- }
- return 1;
+ return drv_generic_graphic_gray(row, col) < 127;
}
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index 14cd95d..78538f8 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -337,6 +337,7 @@ Display LPH7508 {
Port '/dev/parports/0'
Font '6x8'
Contrast 15
+ Inverted 0
}
Display LPH7508-serdisplib {
@@ -347,9 +348,10 @@ Display LPH7508-serdisplib {
Display ctinclud {
Driver 'serdisplib'
- Port 'USB:0x07c0/0x1501'
+ Port 'USB:7c0/1501'
Model 'CTINCLUD'
Options ''
+ Inverted 0
}
Display XWindow {
@@ -834,9 +836,10 @@ Widget GPO_Test255 {
Widget ImageTest {
class 'Image'
- file 'Michi.png'
+ file 'tux.png'
update 1000
visible 1
+ inverted 0
}
Layout Default {
@@ -897,13 +900,6 @@ Layout TestLayer {
}
Layout TestImage {
- Row4 {
- Col1 'OS'
- }
- Row2 {
- Col1 'CPU'
- Col10 'RAM'
- }
Layer 2 {
X1.Y1 'ImageTest'
}
@@ -1038,7 +1034,7 @@ Layout testMySQL {
#Display 'M50530-24x8'
#Display 'LCDTerm'
#Display 'SimpleLCD'
-Display 'BA63'
+#Display 'BA63'
#Display 'CT20x4'
#Display 'T6963-240x64'
#Display 'XWindow'
@@ -1048,12 +1044,12 @@ Display 'BA63'
#Display 'Trefon'
#Display 'LCD2USB'
#Display 'LPH7508-serdisplib'
-#Display 'LPH7508'
+Display 'LPH7508'
#Display 'ctinclud'
-Layout 'Default'
+#Layout 'Default'
#Layout 'TestLayer'
-#Layout 'TestImage'
+Layout 'TestImage'
#Layout 'L8x2'
#Layout 'L16x1'
#Layout 'L16x2'
diff --git a/widget_image.c b/widget_image.c
index e0dc3fd..9ce0ebd 100644
--- a/widget_image.c
+++ b/widget_image.c
@@ -1,4 +1,4 @@
-/* $Id: widget_image.c,v 1.5 2006/02/25 13:36:33 geronet Exp $
+/* $Id: widget_image.c,v 1.6 2006/04/09 14:17:50 reinelt Exp $
*
* image widget handling
*
@@ -21,6 +21,9 @@
*
*
* $Log: widget_image.c,v $
+ * Revision 1.6 2006/04/09 14:17:50 reinelt
+ * autoconf/library fixes, image and graphic display inversion
+ *
* Revision 1.5 2006/02/25 13:36:33 geronet
* updated indent.sh, applied coding style
*
@@ -141,17 +144,24 @@ static void widget_image_render(const char *Name, WIDGET_IMAGE * Image)
}
/* finally really render it */
- for (x = 0; x < gdImage->sx; x++) {
- for (y = 0; y < gdImage->sy; y++) {
- int p = gdImageGetTrueColorPixel(gdImage, x, y);
- int a = gdTrueColorGetAlpha(p);
- int i = y * Image->width + x;
- Image->bitmap[i].R = gdTrueColorGetRed(p);
- Image->bitmap[i].G = gdTrueColorGetGreen(p);
- Image->bitmap[i].B = gdTrueColorGetBlue(p);
- /* GD's alpha is 0 (opaque) to 127 (tranparanet) */
- /* our alpha is 0 (transparent) to 255 (opaque) */
- Image->bitmap[i].A = (a == 127) ? 0 : 255 - 2 * a;
+ if (Image->visible) {
+ for (x = 0; x < gdImage->sx; x++) {
+ for (y = 0; y < gdImage->sy; y++) {
+ int p = gdImageGetTrueColorPixel(gdImage, x, y);
+ int a = gdTrueColorGetAlpha(p);
+ int i = y * Image->width + x;
+ Image->bitmap[i].R = gdTrueColorGetRed(p);
+ Image->bitmap[i].G = gdTrueColorGetGreen(p);
+ Image->bitmap[i].B = gdTrueColorGetBlue(p);
+ /* GD's alpha is 0 (opaque) to 127 (tranparanet) */
+ /* our alpha is 0 (transparent) to 255 (opaque) */
+ Image->bitmap[i].A = (a == 127) ? 0 : 255 - 2 * a;
+ if (Image->inverted) {
+ Image->bitmap[i].R = 255 - Image->bitmap[i].R;
+ Image->bitmap[i].G = 255 - Image->bitmap[i].G;
+ Image->bitmap[i].B = 255 - Image->bitmap[i].B;
+ }
+ }
}
}
}
@@ -191,10 +201,18 @@ static void widget_image_update(void *Self)
if (Image->visible_tree != NULL) {
Eval(Image->visible_tree, &result);
Image->visible = R2N(&result);
- if (Image->visible < 0)
- Image->visible = 0;
+ Image->visible = Image->visible > 0;
+ DelResult(&result);
+ }
+
+ Image->inverted = 0;
+ if (Image->inverted_tree != NULL) {
+ Eval(Image->inverted_tree, &result);
+ Image->inverted = R2N(&result);
+ Image->inverted = Image->inverted > 0;
DelResult(&result);
}
+
#ifdef WITH_GD
/* render image into bitmap */
widget_image_render(W->name, Image);
@@ -240,6 +258,7 @@ int widget_image_init(WIDGET * Self)
Image->file_expr = cfg_get_raw(section, "file", NULL);
Image->update_expr = cfg_get_raw(section, "update", NULL);
Image->visible_expr = cfg_get_raw(section, "visible", NULL);
+ Image->inverted_expr = cfg_get_raw(section, "inverted", NULL);
/* sanity checks */
if (Image->file_expr == NULL || *Image->file_expr == '\0') {
@@ -254,6 +273,7 @@ int widget_image_init(WIDGET * Self)
Compile(Image->file_expr, &Image->file_tree);
Compile(Image->update_expr, &Image->update_tree);
Compile(Image->visible_expr, &Image->visible_tree);
+ Compile(Image->inverted_expr, &Image->inverted_tree);
free(section);
Self->data = Image;
@@ -286,6 +306,7 @@ int widget_image_quit(WIDGET * Self)
DelTree(Image->file_tree);
DelTree(Image->update_tree);
DelTree(Image->visible_tree);
+ DelTree(Image->inverted_tree);
free(Self->data);
Self->data = NULL;
}
diff --git a/widget_image.h b/widget_image.h
index 06927dc..96c25eb 100644
--- a/widget_image.h
+++ b/widget_image.h
@@ -1,4 +1,4 @@
-/* $Id: widget_image.h,v 1.3 2006/02/25 13:36:33 geronet Exp $
+/* $Id: widget_image.h,v 1.4 2006/04/09 14:17:50 reinelt Exp $
*
* image widget handling
*
@@ -23,6 +23,9 @@
*
*
* $Log: widget_image.h,v $
+ * Revision 1.4 2006/04/09 14:17:50 reinelt
+ * autoconf/library fixes, image and graphic display inversion
+ *
* Revision 1.3 2006/02/25 13:36:33 geronet
* updated indent.sh, applied coding style
*
@@ -51,7 +54,10 @@ typedef struct WIDGET_IMAGE {
int update; /* update interval (msec) */
char *visible_expr; /* expression for visibility */
void *visible_tree; /* pre-compiled expression for visibility */
- int visible; /* icon visible? */
+ int visible; /* image visible? */
+ char *inverted_expr; /* expression for inversion */
+ void *inverted_tree; /* pre-compiled expression for inversion */
+ int inverted; /* image inverted? */
} WIDGET_IMAGE;
extern WIDGET_CLASS Widget_Image;