aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-04-24 05:27:09 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-04-24 05:27:09 +0000
commitcc9c2bd2432848924d60846a552dac1d0daf3fa6 (patch)
tree2c8ec515a211fbdd9b14d5744a0596c3c48108cd
parentd0c29c65a8eecfd49ab97af1b85258bdff9185b7 (diff)
downloadlcd4linux-cc9c2bd2432848924d60846a552dac1d0daf3fa6.tar.gz
[lcd4linux @ 2005-04-24 05:27:09 by reinelt]
Trefon Backlight added git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@533 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--drv_Trefon.c43
-rw-r--r--lcd4linux.conf.sample2
2 files changed, 38 insertions, 7 deletions
diff --git a/drv_Trefon.c b/drv_Trefon.c
index f303509..a7fac91 100644
--- a/drv_Trefon.c
+++ b/drv_Trefon.c
@@ -1,4 +1,4 @@
-/* $Id: drv_Trefon.c,v 1.1 2005/04/24 04:33:46 reinelt Exp $
+/* $Id: drv_Trefon.c,v 1.2 2005/04/24 05:27:09 reinelt Exp $
*
* driver for TREFON USB LCD displays
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv_Trefon.c,v $
+ * Revision 1.2 2005/04/24 05:27:09 reinelt
+ * Trefon Backlight added
+ *
* Revision 1.1 2005/04/24 04:33:46 reinelt
* driver for TREFON USB LCD's added
*
@@ -65,10 +68,11 @@
#define LCD_USB_VENDOR 0xfff0
#define LCD_USB_DEVICE 0xfffe
-#define PKT_START 0x02
-#define PKT_DATA 0x02
-#define PKT_CTRL 0x06
-#define PKT_END 0xff
+#define PKT_START 0x02
+#define PKT_BACKLIGHT 0x01
+#define PKT_DATA 0x02
+#define PKT_CTRL 0x06
+#define PKT_END 0xff
static char Name[]="TREFON";
@@ -211,8 +215,23 @@ static void drv_TF_defchar (const int ascii, const unsigned char *matrix)
}
+static int drv_TF_backlight (int backlight)
+{
+ char buffer[4] = { PKT_START, PKT_BACKLIGHT, 0, PKT_END };
+
+ if (backlight < 0) backlight = 0;
+ if (backlight > 1) backlight = 1;
+
+ buffer[2] = backlight;
+ drv_TF_send(buffer, 4);
+
+ return backlight;
+}
+
+
static int drv_TF_start (const char *section, const int quiet)
{
+ int backlight;
int rows=-1, cols=-1;
char *s;
@@ -235,6 +254,10 @@ static int drv_TF_start (const char *section, const int quiet)
return -1;
}
+ if (cfg_number(section, "Backlight", 1, 0, 1, &backlight) > 0) {
+ drv_TF_backlight (backlight);
+ }
+
drv_TF_clear(); /* clear display */
if (!quiet) {
@@ -254,7 +277,13 @@ static int drv_TF_start (const char *section, const int quiet)
/*** plugins ***/
/****************************************/
-/* none */
+static void plugin_backlight (RESULT *result, RESULT *arg1)
+{
+ double backlight;
+
+ backlight = drv_TF_backlight(R2N(arg1));
+ SetResult(&result, R_NUMBER, &backlight);
+}
/****************************************/
@@ -340,7 +369,7 @@ int drv_TF_init (const char *section, const int quiet)
widget_register(&wc);
/* register plugins */
- /* none */
+ AddFunction ("LCD::backlight", 1, plugin_backlight);
return 0;
}
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index d1c10a0..57465f1 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -1,6 +1,8 @@
Display Trefon {
Driver 'TREFON'
Size '16x2'
+ Backlight 1
+ Icons 1
}
6b627)Jonathan McCrohan1-0/+10 2014-10-15Imported Upstream version 0+git20141009.d26b627upstream/0+git20141009.d26b627Jonathan McCrohan2010-11120/+159271 2014-07-23Release 0+git20140611.14bd6c7-1debian/0+git20140611.14bd6c7-1Jonathan McCrohan1-2/+2 2014-07-23New Upstream Snapshot (commit 14bd6c7)Jonathan McCrohan1-2/+3 2014-07-23Imported Upstream version 0+git20140611.14bd6c7upstream/0+git20140611.14bd6c7Jonathan McCrohan7-11/+60 2014-05-13New Upstream Snapshot (commit 1246b27)Jonathan McCrohan1-0/+6 2014-05-13Imported Upstream version 0+git20140512.1246b27upstream/0+git20140512.1246b27Jonathan McCrohan391-301/+3983 2014-04-05Release 0+git20140326.cfc2975-1debian/0+git20140326.cfc2975-1Jonathan McCrohan1-2/+2 2014-04-05d/control: update Homepage (upstream has moved from Gitweb to cgit)Jonathan McCrohan2-1/+2 2014-04-05New Upstream Snapshot (commit cfc2975)Jonathan McCrohan1-0/+6 2014-04-05Imported Upstream version 0+git20140326.cfc2975upstream/0+git20140326.cfc2975Jonathan McCrohan118-656/+877 2014-01-16Release 0+git20140107.1850cf8-1debian/0+git20140107.1850cf8-1Jonathan McCrohan1-2/+2 2014-01-16Update Standards Version to 3.9.5Jonathan McCrohan2-1/+9