thermferm/lcd-pcf8574.c

changeset 420
644a6106d712
parent 223
14700edd2a67
child 426
e54611453d29
--- a/thermferm/lcd-pcf8574.c	Sun Nov 08 22:20:42 2015 +0100
+++ b/thermferm/lcd-pcf8574.c	Sat Nov 14 16:52:33 2015 +0100
@@ -25,12 +25,14 @@
 
 #include "thermferm.h"
 #include "lcd-pcf8574.h"
+#include "slcd.h"
+
+
+int			lcdHandle;
+int			slcdHandle;
 
 
 #ifdef HAVE_WIRINGPI_H
-
-int			lcdHandle;
-
 struct lcdDataStruct
 {
     int bits, rows, cols ;
@@ -40,6 +42,7 @@
 };
 
 extern struct lcdDataStruct	*lcds [MAX_LCDS];
+#endif
 extern sys_config       	Config;
 
 
@@ -48,13 +51,13 @@
  * setBacklight:
  *********************************************************************************
  */
-
+#ifdef HAVE_WIRINGPI_H
 void setBacklight (int value)
 {
   pinMode (AF_BACKLIGHT, OUTPUT) ;
   digitalWrite (AF_BACKLIGHT, (value & 1)) ;
 }
-
+#endif
 
 
 /*
@@ -74,6 +77,7 @@
     	return EXIT_FAILURE ;
     }
 
+#ifdef HAVE_WIRINGPI_H
     pcf8574Setup(AF_BASE, 0x27) ;
     pinMode (AF_RW, OUTPUT) ;
     digitalWrite (AF_RW, LOW) ;        // Not used with wiringPi - always in write mode
@@ -89,9 +93,16 @@
 
     lcdClear (lcdHandle) ;
     setBacklight (1) ;
+#endif
+
+    slcdHandle = slcdInit(0, rows, cols);
+    if (slcdHandle < 0) {
+	fprintf (stderr, "slcdInit failed\n") ;
+	return -1;
+    }
+    slcdClear(slcdHandle);
 
     return 0 ;
 }
 
 
-#endif

mercurial