23 *********************************************************************** |
23 *********************************************************************** |
24 */ |
24 */ |
25 |
25 |
26 #include "thermferm.h" |
26 #include "thermferm.h" |
27 #include "lcd-pcf8574.h" |
27 #include "lcd-pcf8574.h" |
|
28 #include "slcd.h" |
|
29 |
|
30 |
|
31 int lcdHandle; |
|
32 int slcdHandle; |
28 |
33 |
29 |
34 |
30 #ifdef HAVE_WIRINGPI_H |
35 #ifdef HAVE_WIRINGPI_H |
31 |
|
32 int lcdHandle; |
|
33 |
|
34 struct lcdDataStruct |
36 struct lcdDataStruct |
35 { |
37 { |
36 int bits, rows, cols ; |
38 int bits, rows, cols ; |
37 int rsPin, strbPin ; |
39 int rsPin, strbPin ; |
38 int dataPins [8] ; |
40 int dataPins [8] ; |
39 int cx, cy ; |
41 int cx, cy ; |
40 }; |
42 }; |
41 |
43 |
42 extern struct lcdDataStruct *lcds [MAX_LCDS]; |
44 extern struct lcdDataStruct *lcds [MAX_LCDS]; |
|
45 #endif |
43 extern sys_config Config; |
46 extern sys_config Config; |
44 |
47 |
45 |
48 |
46 |
49 |
47 /* |
50 /* |
48 * setBacklight: |
51 * setBacklight: |
49 ********************************************************************************* |
52 ********************************************************************************* |
50 */ |
53 */ |
51 |
54 #ifdef HAVE_WIRINGPI_H |
52 void setBacklight (int value) |
55 void setBacklight (int value) |
53 { |
56 { |
54 pinMode (AF_BACKLIGHT, OUTPUT) ; |
57 pinMode (AF_BACKLIGHT, OUTPUT) ; |
55 digitalWrite (AF_BACKLIGHT, (value & 1)) ; |
58 digitalWrite (AF_BACKLIGHT, (value & 1)) ; |
56 } |
59 } |
57 |
60 #endif |
58 |
61 |
59 |
62 |
60 /* |
63 /* |
61 * initLCD: |
64 * initLCD: |
62 ********************************************************************************* |
65 ********************************************************************************* |
72 if (!((cols == 16) || (cols == 20))) { |
75 if (!((cols == 16) || (cols == 20))) { |
73 fprintf (stderr, "cols must be 16 or 20\n") ; |
76 fprintf (stderr, "cols must be 16 or 20\n") ; |
74 return EXIT_FAILURE ; |
77 return EXIT_FAILURE ; |
75 } |
78 } |
76 |
79 |
|
80 #ifdef HAVE_WIRINGPI_H |
77 pcf8574Setup(AF_BASE, 0x27) ; |
81 pcf8574Setup(AF_BASE, 0x27) ; |
78 pinMode (AF_RW, OUTPUT) ; |
82 pinMode (AF_RW, OUTPUT) ; |
79 digitalWrite (AF_RW, LOW) ; // Not used with wiringPi - always in write mode |
83 digitalWrite (AF_RW, LOW) ; // Not used with wiringPi - always in write mode |
80 |
84 |
81 /* |
85 /* |