#include "drv.h"
#include "drv_generic_text.h"
#include "drv_generic_gpio.h"
+
+#ifdef WITH_PARPORT
#include "drv_generic_parport.h"
+#endif
#ifdef WITH_I2C
#include "drv_generic_i2c.h"
/* Timings */
+#ifdef WITH_PARPORT
static int T_CY, T_PW, T_AS, T_AH;
-static int T_POWER, T_INIT1, T_INIT2, T_EXEC, T_WRCG, T_CLEAR, T_HOME, T_ONOFF;
-static int T_GPO_ST, T_GPO_PW;
-static int T_POWER;
+#endif
+static int T_INIT1, T_INIT2, T_EXEC, T_WRCG, T_CLEAR, T_HOME, T_ONOFF;
+#ifdef WITH_PARPORT
+static int T_POWER, T_GPO_ST, T_GPO_PW;
+#endif
static int Bits = 0;
static int numControllers = 0;
static unsigned char SIGNAL_ENABLE2;
static unsigned char SIGNAL_ENABLE3;
static unsigned char SIGNAL_ENABLE4;
-static unsigned char SIGNAL_BACKLIGHT;
+
static unsigned char SIGNAL_GPO;
+#ifdef WITH_PARPORT
+static unsigned char SIGNAL_BACKLIGHT;
static unsigned char SIGNAL_POWER;
+#endif
/* maximum time to wait for the busy-flag (in usec) */
#define MAX_BUSYFLAG_WAIT 10000
#define MAX_BUSYFLAG_ERRORS 20
/* flag for busy-waiting vs. busy flag checking */
+#ifdef WITH_PARPORT
static int UseBusy = 0;
+#endif
/* buffer holding the GPO state */
+#ifdef WITH_PARPORT
static unsigned char GPO = 0;
-
+#endif
typedef struct {
int type;
/*** parport dependant functions ***/
/****************************************/
+#ifdef WITH_PARPORT
+
static void drv_HD_PP_busy(const int controller)
{
static unsigned int errors = 0;
}
+#endif
+
#ifdef WITH_I2C
}
+#ifdef WITH_PARPORT
+
static int drv_HD_backlight(int backlight)
{
if (!(Capabilities & CAP_BACKLIGHT))
backlight = 1;
drv_generic_parport_control(SIGNAL_BACKLIGHT, backlight ? SIGNAL_BACKLIGHT : 0);
-
+
return backlight;
}
+#endif
+
static int drv_HD_brightness(int brightness)
{
}
+#ifdef WITH_PARPORT
+
static int drv_HD_GPO(const int num, const int val)
{
int v;
return v;
}
+#endif
+
+
+#ifdef WITH_PARPORT
static void drv_HD_LCM162_timer(void __attribute__ ((unused)) * notused)
{
}
}
+#endif
+
static int drv_HD_start(const char *section, const int quiet)
{
}
if (strcasecmp(bus, "parport") == 0) {
+
+#ifdef WITH_PARPORT
info("%s: using parallel port", Name);
Bus = BUS_PP;
drv_HD_load = drv_HD_PP_load;
drv_HD_command = drv_HD_PP_command;
drv_HD_data = drv_HD_PP_data;
drv_HD_stop = drv_HD_PP_stop;
+#else
+ error("%s: %s.Bus '%s' from %s not available:", Name, section, bus, cfg_source());
+ error("%s: lcd4linux was compiled without parport support!", Name);
+ free(bus);
+ return -1;
+#endif
} else if (strcasecmp(bus, "i2c") == 0) {
+
#ifdef WITH_I2C
info("%s: using I2C bus", Name);
Bus = BUS_I2C;
drv_HD_command(allControllers, 0x03, T_HOME); /* return home */
/* maybe set backlight */
+#ifdef WITH_PARPORT
if (Capabilities & CAP_BACKLIGHT) {
int backlight;
if (cfg_number(section, "Backlight", 0, 0, 1, &backlight) > 0) {
drv_HD_backlight(backlight);
}
}
+#endif
/* maybe set brightness */
if (Capabilities & CAP_BRIGHTNESS) {
}
/* install keypad polling timer for LCM-162 */
+#ifdef WITH_PARPORT
if (Capabilities & CAP_LCM162) {
timer_add(drv_HD_LCM162_timer, NULL, 10, 0);
}
+#endif
if (!quiet) {
char buffer[40];
/****************************************/
+#ifdef WITH_PARPORT
static void plugin_backlight(RESULT * result, RESULT * arg1)
{
double backlight;
backlight = drv_HD_backlight(R2N(arg1));
SetResult(&result, R_NUMBER, &backlight);
}
-
+#endif
static void plugin_brightness(RESULT * result, RESULT * arg1)
{
/* real worker functions */
drv_generic_text_real_write = drv_HD_write;
drv_generic_text_real_defchar = drv_HD_defchar;
+#ifdef WITH_PARPORT
drv_generic_gpio_real_set = drv_HD_GPO;
-
+#endif
/* start display */
if ((ret = drv_HD_start(section, quiet)) != 0)
widget_register(&wc);
/* register plugins */
+#ifdef WITH_PARPORT
if (Capabilities & CAP_BACKLIGHT) {
AddFunction("LCD::backlight", 1, plugin_backlight);
}
+#endif
if (Capabilities & CAP_BRIGHTNESS) {
AddFunction("LCD::brightness", 1, plugin_brightness);
}