Merge pull request #6 from bytemine/master

add driver for lcm162-module (by H. Rasch) (https://github.com/lcdproc/lcdproc/pull/6)
This commit is contained in:
willfe
2016-07-28 09:14:22 -04:00
committed by GitHub
6 changed files with 147 additions and 2 deletions
+1 -1
View File
@@ -214,7 +214,7 @@ dnl else
actdrivers=["$actdrivers glk"]
;;
hd44780)
HD44780_DRIVERS="hd44780-hd44780-serial.o hd44780-hd44780-lis2.o hd44780-hd44780-usblcd.o"
HD44780_DRIVERS="hd44780-hd44780-serial.o hd44780-hd44780-lis2.o hd44780-hd44780-usblcd.o hd44780-hd44780-lcm162.o"
if test "$ac_cv_port_have_lpt" = yes ; then
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-4bit.o hd44780-hd44780-ext8bit.o hd44780-lcd_sem.o hd44780-hd44780-winamp.o hd44780-hd44780-serialLpt.o"
fi
+1 -1
View File
@@ -95,7 +95,7 @@ EXTRA_glcd_SOURCES = glcd-t6963.c t6963_low.c t6963_low.h glcd-png.c glcd-serdis
glcdlib_SOURCES = lcd.h lcd_lib.h glcdlib.h glcdlib.c report.h
glk_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
hd44780_SOURCES = lcd.h lcd_lib.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h adv_bignum.h
EXTRA_hd44780_SOURCES = port.h lpt-port.h timing.h lcd_sem.c lcd_sem.h hd44780-4bit.c hd44780-4bit.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-ethlcd.c hd44780-ethlcd.h hd44780-ext8bit.c hd44780-ext8bit.h hd44780-ftdi.c hd44780-ftdi.h hd44780-i2c.c hd44780-i2c.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-lis2.c hd44780-lis2.h hd44780-pifacecad.c hd44780-pifacecad.h hd44780-piplate.c hd44780-piplate.h hd44780-rpi.c hd44780-rpi.h hd44780-serial.c hd44780-serial.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-spi.c hd44780-spi.h hd44780-usb4all.c hd44780-usb4all.h hd44780-usblcd.c hd44780-usblcd.h hd44780-usbtiny.c hd44780-usbtiny.h hd44780-uss720.c hd44780-uss720.h hd44780-winamp.c hd44780-winamp.h
EXTRA_hd44780_SOURCES = port.h lpt-port.h timing.h lcd_sem.c lcd_sem.h hd44780-4bit.c hd44780-4bit.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-ethlcd.c hd44780-ethlcd.h hd44780-ext8bit.c hd44780-ext8bit.h hd44780-ftdi.c hd44780-ftdi.h hd44780-i2c.c hd44780-i2c.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-lis2.c hd44780-lis2.h hd44780-pifacecad.c hd44780-pifacecad.h hd44780-piplate.c hd44780-piplate.h hd44780-rpi.c hd44780-rpi.h hd44780-serial.c hd44780-serial.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-spi.c hd44780-spi.h hd44780-usb4all.c hd44780-usb4all.h hd44780-usblcd.c hd44780-usblcd.h hd44780-usbtiny.c hd44780-usbtiny.h hd44780-uss720.c hd44780-uss720.h hd44780-winamp.c hd44780-winamp.h hd44780-lcm162.c hd44780-lcm162.h
i2500vfd_SOURCES = lcd.h i2500vfd.c i2500vfd.h glcd_font5x8.h report.h
icp_a106_SOURCES = lcd.h lcd_lib.h icp_a106.c icp_a106.h report.h
imon_SOURCES = lcd.h lcd_lib.h hd44780-charmap.h imon.h imon.c report.h adv_bignum.h
+2
View File
@@ -16,6 +16,7 @@
# include "hd44780-ext8bit.h"
# include "hd44780-serialLpt.h"
# include "hd44780-winamp.h"
# include "hd44780-lcm162.h"
#endif
#include "hd44780-serial.h"
#include "hd44780-lis2.h"
@@ -60,6 +61,7 @@ static const ConnectionMapping connectionMapping[] = {
{ "8bit", HD44780_CT_8BIT, IF_TYPE_PARPORT, hd_init_ext8bit },
{ "serialLpt", HD44780_CT_SERIALLPT, IF_TYPE_PARPORT, hd_init_serialLpt },
{ "winamp", HD44780_CT_WINAMP, IF_TYPE_PARPORT, hd_init_winamp },
{ "lcm162", HD44780_CT_LCM162, IF_TYPE_PARPORT, hd_init_lcm162 },
#endif
/* serial connection types */
{ "picanlcd", HD44780_CT_PICANLCD, IF_TYPE_SERIAL, hd_init_serial },
+133
View File
@@ -0,0 +1,133 @@
/*
* 8-bit driver module for Hitachi HD44780 based LCD displays.
* The LCD is operated in it's 8 bit-mode to be connected to a single
* PC parallel port.
*
* Copyright (c) 1999, 1995 Benjamin Tse <blt@Comports.com>
* 2001 Joris Robijn <joris@robijn.net>
* 2009 Holger Rasch <rasch@bytemine.net>
*
* Created modular driver Dec 1999, Benjamin Tse <blt@Comports.com>
*
* Based on the code in the lcdtime package which uses the LCD
* controller in its 8-bit mode.
*
* This file is released under the GNU General Public License. Refer to the
* COPYING file distributed with this package.
*/
/*
* Copied from "hd44780-ext8.c" and modified for lcm-162 module
* found in nexcom nsaXXXX models.
*/
#include "hd44780-lcm162.h"
#include "hd44780-low.h"
#include "lpt-port.h"
#include "port.h"
#include "report.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
// Generally, any function that accesses the LCD control lines needs to be
// implemented separately for each HW design. This is typically (but not
// restricted to):
// HD44780_senddata
// HD44780_readkeypad
void lcm162_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
void lcm162_HD44780_backlight(PrivateData *p, unsigned char state);
unsigned char lcm162_HD44780_readkeypad(PrivateData *p, unsigned int YData);
void lcm162_HD44780_output(PrivateData *p, int data);
/* lcm-162 specific mapping parport <-> hd44780 signals */
#define RS SEL
#define RW INIT
#define EN1 LF
// initialise the driver
int
hd_init_lcm162(Driver *drvthis)
{
PrivateData *p = (PrivateData*) drvthis->private_data;
HD44780_functions *hd44780_functions = p->hd44780_functions;
// Reserve the port registers
if (port_access_multiple(p->port,3)) {
report(RPT_ERR, "%s: cannot get IO-permission for 0x%03X: %s",
drvthis->name, p->port, strerror(errno));
return -1;
}
hd44780_functions->senddata = lcm162_HD44780_senddata;
hd44780_functions->backlight = lcm162_HD44780_backlight;
hd44780_functions->readkeypad = lcm162_HD44780_readkeypad;
// setup the lcd in 8 bit mode
hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT);
hd44780_functions->uPause(p, 4100);
hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT);
hd44780_functions->uPause(p, 100);
hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT | TWOLINE | SMALLCHAR);
hd44780_functions->uPause(p, 40);
common_init (p, IF_8BIT);
if (p->have_keypad)
p->stuckinputs = 0; /* unused here */
// Writes new value to the "bargraph" latches
hd44780_functions->output = 0;
return 0;
}
// lcm162_HD44780_senddata
void
lcm162_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
{
unsigned char enableLines = 0, portControl;
// Only one controller is supported
enableLines = EN1;
if (flags == RS_INSTR)
portControl = 0;
else //if (iflags == RS_DATA)
portControl = RS;
portControl |= p->backlight_bit;
port_out(p->port + 2, portControl ^ OUTMASK);
port_out(p->port, ch);
if (p->delayBus) p->hd44780_functions->uPause(p, 1);
port_out(p->port + 2, (enableLines|portControl) ^ OUTMASK);
if (p->delayBus) p->hd44780_functions->uPause(p, 1);
port_out(p->port + 2, portControl ^ OUTMASK);
}
void lcm162_HD44780_backlight(PrivateData *p, unsigned char state)
{
/* ignore config, there is no backlight control on the lcm-162 */
return;
}
unsigned char lcm162_HD44780_readkeypad(PrivateData *p, unsigned int YData)
{
unsigned char readval;
if (YData) return 0; /* no keymatrix */
readval = port_in(p->port + 1);
if (readval & ACK) { /* a key is pressed */
/* 4 keys encoded in signals PAPEREND and FAULT */
/* map them to low nibble (multiple keys not supported) */
return 1 << (
((readval & FAULT) / FAULT << 1) |
((readval & PAPEREND) / PAPEREND)
);
} else
return 0;
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef HD_LCM162_H
#define HD_LCM162_H
#include "lcd.h" /* for Driver */
// initialise this particular driver
int hd_init_lcm162(Driver *drvthis);
#endif
+1
View File
@@ -57,6 +57,7 @@
#define HD44780_CT_PIPLATE 23
#define HD44780_CT_SPI 24
#define HD44780_CT_PIFACECAD 25
#define HD44780_CT_LCM162 26
/**@}*/
/** \name Symbolic names for interface types