]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2005-12-19 05:08:27 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 19 Dec 2005 05:08:31 +0000 (05:08 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 19 Dec 2005 05:08:31 +0000 (05:08 +0000)
GPO's added to the Sample driver

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@603 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

configure
drivers.m4
drv_Sample.c
lcd4linux.conf.sample

index a55452ac9de9d0202c13ddb66df19912e8e10de1..896b484fa281d588d78b3efb031d9bc7641f0a04 100755 (executable)
--- 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"
index cd859743f60ee1b36875989297f8748e750ea3ac..c100f455e226c7885f90ab59341f556537c11bf4 100644 (file)
@@ -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"
index 6ed5490f1642be8a238dff37375004f0fc5a9adf..09efd506b1cf4d16de2e6c6d06d65b9b46b2ac5c 100644 (file)
@@ -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);
index ca0479310387beae1945110986edd7df027ed9df..2b45f1cad18f70d2dcd2604ed446cafb684a3179 100644 (file)
@@ -844,6 +844,8 @@ Layout TestGPO {
     Row1.Col1 'Test1'
 #   GPO7      'GPO_Test'
     GPO2      'GPO_Test2'
+   GPO1      'GPO_Test'
+
 }
 
 Layout testMySQL {