aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <>2005-12-19 05:08:31 +0000
committerreinelt <>2005-12-19 05:08:31 +0000
commit7dfeea43c5cbd5bd160fc8ab85872cdbeb225e09 (patch)
treee817a6fd50d491cf4c86b1ad954e965e37d88d41
parentf57473f6a80c5776474fe300bb599f7f86389507 (diff)
downloadlcd4linux-7dfeea43c5cbd5bd160fc8ab85872cdbeb225e09.tar.gz
[lcd4linux @ 2005-12-19 05:08:27 by reinelt]
GPO's added to the Sample driver
Diffstat (limited to '')
-rwxr-xr-xconfigure2
-rw-r--r--drivers.m42
-rw-r--r--drv_Sample.c57
-rw-r--r--lcd4linux.conf.sample2
4 files changed, 56 insertions, 7 deletions
diff --git a/configure b/configure
index a55452a..896b484 100755
--- a/configure
+++ b/configure
@@ -6370,6 +6370,8 @@ if test "$SAMPLE" = "yes"; then
# select either text or graphics mode
TEXT="yes"
GRAPHIC="yes"
+ # support for GPO's
+ GPO="yes"
# select bus: serial (including USB), parallel or i2c
SERIAL="yes"
PARPORT="yes"
diff --git a/drivers.m4 b/drivers.m4
index cd85974..c100f45 100644
--- a/drivers.m4
+++ b/drivers.m4
@@ -317,6 +317,8 @@ if test "$SAMPLE" = "yes"; then
# select either text or graphics mode
TEXT="yes"
GRAPHIC="yes"
+ # support for GPO's
+ GPO="yes"
# select bus: serial (including USB), parallel or i2c
SERIAL="yes"
PARPORT="yes"
diff --git a/drv_Sample.c b/drv_Sample.c
index 6ed5490..09efd50 100644
--- a/drv_Sample.c
+++ b/drv_Sample.c
@@ -1,4 +1,4 @@
-/* $Id: drv_Sample.c,v 1.1 2005/11/04 14:10:38 reinelt Exp $
+/* $Id: drv_Sample.c,v 1.2 2005/12/19 05:08:31 reinelt Exp $
*
* sample lcd4linux driver
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv_Sample.c,v $
+ * Revision 1.2 2005/12/19 05:08:31 reinelt
+ * GPO's added to the Sample driver
+ *
* Revision 1.1 2005/11/04 14:10:38 reinelt
* drv_Sample and drv_LPH7508
*
@@ -62,6 +65,9 @@
/* graphic display? */
#include "drv_generic_graphic.h"
+/* GPO's? */
+#include "drv_generic_gpio.h"
+
/* serial port? */
#include "drv_generic_serial.h"
@@ -94,17 +100,17 @@ static void drv_Sample_bang(const unsigned int data)
{
/* put data on DB1..DB8 */
drv_generic_parport_data(data & 0xff);
-
+
/* set/clear some signals */
drv_generic_parport_control(SIGNAL_RS, SIGNAL_RS);
-
+
/* data setup time (e.g. 200 ns) */
ndelay(200);
-
+
/* send byte */
/* signal pulse width 500ns */
drv_generic_parport_toggle(SIGNAL_EX, 1, 500);
-
+
/* wait for command completion (e.g. 100 us) */
udelay(100);
}
@@ -157,13 +163,13 @@ static int drv_Sample_close(void)
static void drv_Sample_send(const char *data, const unsigned int len)
{
unsigned int i;
-
+
/* send data to the serial port is easy... */
drv_generic_serial_write(data, len);
/* sending data to the parallel port is a bit more tricky... */
for (i = 0; i < len; i++) {
- drv_Sample_bang (*data++);
+ drv_Sample_bang(*data++);
}
}
@@ -233,6 +239,22 @@ static void drv_Sample_blit(const int row, const int col, const int height, cons
}
+/* remove unless you have GPO's */
+static int drv_Sample_GPO(const int num, const int val)
+{
+ char cmd[4];
+
+ /* assume 0x42 to be the 'GPO' command */
+ cmd[0] = 0x42;
+ cmd[1] = num;
+ cmd[2] = (val > 0) ? 1 : 0;
+
+ drv_Sample_send(cmd, 3);
+
+ return 0;
+}
+
+
/* example function used in a plugin */
static int drv_Sample_contrast(int contrast)
{
@@ -276,6 +298,9 @@ static int drv_Sample_start(const char *section)
DROWS = rows;
DCOLS = cols;
+ /* number of GPO's; remove if you don't have them */
+ GPOS = 8;
+
/* open communication with the display */
if (drv_Sample_open(section) < 0) {
return -1;
@@ -377,6 +402,7 @@ static void plugin_contrast(RESULT * result, RESULT * arg1)
/* 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) */
/****************************************/
@@ -410,6 +436,9 @@ int drv_Sample_init(const char *section, const int quiet)
drv_generic_text_real_write = drv_Sample_write;
drv_generic_text_real_defchar = drv_Sample_defchar;
+ /* remove unless you have GPO's */
+ drv_generic_gpio_real_set = drv_Sample_GPO;
+
/* start display */
if ((ret = drv_Sample_start(section)) != 0)
@@ -440,6 +469,11 @@ int drv_Sample_init(const char *section, const int quiet)
drv_generic_text_bar_add_segment(0, 0, 255, 32); /* ASCII 32 = blank */
+ /* initialize generic GPIO driver */
+ /* remove unless you have GPO's */
+ if ((ret = drv_generic_gpio_init(section, Name)) != 0)
+ return ret;
+
/* register text widget */
wc = Widget_Text;
wc.draw = drv_generic_text_draw;
@@ -472,6 +506,9 @@ int drv_Sample_init2(const char *section, const int quiet)
/* real worker functions */
drv_generic_graphic_real_blit = drv_Sample_blit;
+ /* remove unless you have GPO's */
+ drv_generic_gpio_real_set = drv_Sample_GPO;
+
/* start display */
if ((ret = drv_Sample_start2(section)) != 0)
return ret;
@@ -525,6 +562,9 @@ int drv_Sample_quit(const int quiet)
/* clear display */
drv_Sample_clear();
+ /* remove unless you have GPO's */
+ drv_generic_gpio_clear();
+
/* say goodbye... */
if (!quiet) {
drv_generic_text_greet("goodbye!", NULL);
@@ -546,6 +586,9 @@ int drv_Sample_quit2(const int quiet)
/* clear display */
drv_generic_graphic_clear();
+ /* remove unless you have GPO's */
+ drv_generic_gpio_clear();
+
/* say goodbye... */
if (!quiet) {
drv_generic_graphic_greet("goodbye!", NULL);
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index ca04793..2b45f1c 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -844,6 +844,8 @@ Layout TestGPO {
Row1.Col1 'Test1'
# GPO7 'GPO_Test'
GPO2 'GPO_Test2'
+ GPO1 'GPO_Test'
+
}
Layout testMySQL {