add Matteo Pillon's lcdserializer ConnectionType patch to the hd44780 driver
This commit is contained in:
+2
-2
@@ -132,9 +132,9 @@ dnl else
|
||||
;;
|
||||
hd44780)
|
||||
if test "$ac_cv_port_have_lpt" = yes ; then
|
||||
HD44780_DRIVERS="hd44780-4bit.o hd44780-ext8bit.o lcd_sem.o hd44780-winamp.o hd44780-serialLpt.o hd44780-picanlcd.o"
|
||||
HD44780_DRIVERS="hd44780-4bit.o hd44780-ext8bit.o lcd_sem.o hd44780-winamp.o hd44780-serialLpt.o hd44780-picanlcd.o hd44780-lcdserializer.o"
|
||||
else
|
||||
HD44780_DRIVERS="hd44780-picanlcd.o"
|
||||
HD44780_DRIVERS="hd44780-picanlcd.o hd44780-lcdserializer.o"
|
||||
fi
|
||||
if test "$enable_libusb" = yes ; then
|
||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-bwct-usb.o"
|
||||
|
||||
@@ -1032,6 +1032,65 @@ It does not support a keypad nor backlight switching.
|
||||
|
||||
</sect3>
|
||||
|
||||
<sect3 id="hd44780-lcdserializer">
|
||||
<title>LCD serializer device "lcdserializer"</title>
|
||||
|
||||
<para>
|
||||
LCD serializer connection is technically the same of PIC-an-LCD with the same advantages,
|
||||
it uses the serial making things really simple.
|
||||
<link linkend="http://www.mindspring.com/~tcoonan/lcd.html">LCD serializer</link>
|
||||
is not a commercial product like PIC-an-LCD, it's just a project found digging on the net freely available.
|
||||
You have all the tools and the code to build it yourself and to customize the behaviour of the device.
|
||||
</para>
|
||||
|
||||
<sect4 id="hd44780-lcdserializer-whatyouneed">
|
||||
<title>What you need</title>
|
||||
|
||||
<para>
|
||||
<itemizedlist>
|
||||
<listitem><para>Some electronic knowledge and familiarity with the soldering iron</para></listitem>
|
||||
<listitem><para>A PIC16F84 (I used PIC16F84A) or PIC16C54</para></listitem>
|
||||
<listitem><para><link linkend="http://jdm.homepage.dk/newpic.htm">JDM PIC programmer</link></para></listitem>
|
||||
<listitem><para><link linkend="http://gputils.sf.net">gputils</link> and <link linkend="http://www.iki.fi/hyvatti/pic/picprog.html">picprog</link> installed on your GNU/Linux box</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</sect4>
|
||||
|
||||
<sect4 id="hd44780-lcdserializer-burning">
|
||||
<title>Burning the PIC</title>
|
||||
|
||||
<para>
|
||||
First, you need to download the asm source for your pic and then make the hex:
|
||||
<command>
|
||||
wget http://www.mindspring.com/~tcoonan/lcd18f84.asm
|
||||
gpasm lcd18f84_custom.asm
|
||||
</command>
|
||||
Now the binary is ready to be flashed to the PIC.
|
||||
Connect the programmer with the PIC installed and issue the following command to see it burning ;-):
|
||||
<command>
|
||||
picprog --erase --burn --input lcd16f84.hex --pic /dev/ttyS0
|
||||
</command>
|
||||
|
||||
</para>
|
||||
</sect4>
|
||||
|
||||
<sect4 id="hd44780-lcdserializer-runninglcdproc">
|
||||
<title>Running lcdproc</title>
|
||||
|
||||
<para>
|
||||
It's time to build the <link linkend="http://www.mindspring.com/~tcoonan/lcdpic.html">operating circuit</link> and to power on your new toy.
|
||||
You should see OK. on the LCD screen, otherwise, double-check all the connections.
|
||||
Now change LCDd.conf to include the following statments in the hd44780 section:
|
||||
<command>
|
||||
ConnectionType=lcdserializer
|
||||
Device=/dev/ttyS0
|
||||
</command>
|
||||
Start the daemon and relax watching lcdproc running.
|
||||
</para>
|
||||
</sect4>
|
||||
</sect3>
|
||||
|
||||
|
||||
<sect3 id="hd44780-bwctusb">
|
||||
<title>BWCT USB device "bwctusb"</title>
|
||||
|
||||
@@ -1040,7 +1099,7 @@ The BWCT USB LCD module is also supported. It is not connected to an LPT port
|
||||
but to an USB port, which saves you from a lot of potential problems.
|
||||
To use it, set the connection type in the config file with the ConnectionType=
|
||||
setting to "bwctusb" (without the quotes).
|
||||
It does neithert support a keypad nor backlight switching but it supports setting
|
||||
It does neither support a keypad nor backlight switching but it supports setting
|
||||
the display's contrast using the "Contrast" configuration parameter as well as
|
||||
specifying which one (of multiple BWCT LCD devices) is wanted using the
|
||||
"SerialNumber" configuration parameter.
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
# include "hd44780-bwct-usb.h"
|
||||
#endif
|
||||
#include "hd44780-picanlcd.h"
|
||||
#include "hd44780-lcdserializer.h"
|
||||
// add new connection type header files here
|
||||
|
||||
static const ConnectionMapping connectionMapping[] = {
|
||||
@@ -35,6 +36,7 @@ static const ConnectionMapping connectionMapping[] = {
|
||||
{"winamp", hd_init_winamp, "\tnone\n"},
|
||||
#endif
|
||||
{"picanlcd", hd_init_picanlcd, "\tnone\n"},
|
||||
{"lcdserializer", hd_init_lcdserializer, "\tnone\n"},
|
||||
#ifdef HAVE_LIBUSB
|
||||
{"bwctusb", hd_init_bwct_usb, "\tnone\n"},
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* LCD Serializer driver
|
||||
* Modification of the code of the PIC-an-LCD driver
|
||||
*
|
||||
* Copyright (c) 1997, Matthias Prinke <m.prinke@trashcan.mcnet.de>
|
||||
* 1998, Richard Rognlie <rrognlie@gamerz.net>
|
||||
* 1999, Ethan Dicks
|
||||
* 1999-2000, Benjamin Tse <blt@Comports.com>
|
||||
* 2001, Rene Wagner
|
||||
* 2001-2002, Joris Robijn <joris@robijn.net>
|
||||
* 2005, Pillon Matteo <matteo.pillon@email.it>
|
||||
*
|
||||
* This file is released under the GNU General Public License. Refer to the
|
||||
* COPYING file distributed with this package.
|
||||
*
|
||||
* LCD Serializer code and documentation:
|
||||
* http://www.mindspring.com/~tcoonan/lcd.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hd44780-lcdserializer.h"
|
||||
#include "hd44780-low.h"
|
||||
|
||||
#include "report.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
// 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 lcdserializer_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
|
||||
void lcdserializer_HD44780_backlight (PrivateData *p, unsigned char state);
|
||||
unsigned char lcdserializer_HD44780_scankeypad (PrivateData *p);
|
||||
|
||||
#define LCDSERIALIZER_LCDI '\xFE'
|
||||
|
||||
#define DEFAULT_DEVICE "/dev/lcd"
|
||||
|
||||
// initialise the driver
|
||||
int
|
||||
hd_init_lcdserializer (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = (PrivateData*) drvthis->private_data;
|
||||
|
||||
struct termios portset;
|
||||
char device[256] = DEFAULT_DEVICE;
|
||||
|
||||
/* READ CONFIG FILE */
|
||||
|
||||
/* Get serial device to use */
|
||||
strncpy(device, drvthis->config_get_string ( drvthis->name , "device" , 0 , DEFAULT_DEVICE),sizeof(device));
|
||||
device[sizeof(device)-1]=0;
|
||||
report (RPT_INFO,"HD44780: LCD Serializer: Using device: %s", device);
|
||||
|
||||
// Set up io port correctly, and open it...
|
||||
p->fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
if (p->fd == -1) {
|
||||
report(RPT_ERR, "HD44780: LCD Serializer: could not open device %s (%s)\n", device, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get serial device parameters */
|
||||
tcgetattr(p->fd, &portset);
|
||||
|
||||
/* We use RAW mode */
|
||||
#ifdef HAVE_CFMAKERAW
|
||||
/* The easy way */
|
||||
cfmakeraw( &portset );
|
||||
#else
|
||||
/* The hard way */
|
||||
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
|
||||
| INLCR | IGNCR | ICRNL | IXON );
|
||||
portset.c_oflag &= ~OPOST;
|
||||
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
|
||||
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
|
||||
portset.c_cflag |= CS8 | CREAD | CLOCAL ;
|
||||
#endif
|
||||
/* Set port speed to 9600 baud */
|
||||
cfsetospeed(&portset, B9600);
|
||||
|
||||
/* Set TCSANOW mode of serial device */
|
||||
tcsetattr(p->fd, TCSANOW, &portset);
|
||||
|
||||
p->hd44780_functions->senddata = lcdserializer_HD44780_senddata;
|
||||
p->hd44780_functions->backlight = lcdserializer_HD44780_backlight;
|
||||
p->hd44780_functions->scankeypad = lcdserializer_HD44780_scankeypad;
|
||||
|
||||
common_init (p, IF_8BIT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
lcdserializer_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
|
||||
{
|
||||
static const char instr_byte = LCDSERIALIZER_LCDI;
|
||||
|
||||
if (flags == RS_DATA) {
|
||||
write( p->fd, &ch, 1 );
|
||||
}
|
||||
else {
|
||||
write( p->fd, &instr_byte, 1 );
|
||||
write( p->fd, &ch, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
lcdserializer_HD44780_backlight (PrivateData *p, unsigned char state)
|
||||
{
|
||||
/* No backlight control */
|
||||
}
|
||||
|
||||
unsigned char
|
||||
lcdserializer_HD44780_scankeypad (PrivateData *p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef HD_LCDSERIALIZER_H
|
||||
#define HD_LCDSERIALIZER_H
|
||||
|
||||
#include "lcd.h" /* for Driver */
|
||||
|
||||
// initialise this particular driver
|
||||
int hd_init_lcdserializer (Driver *drvthis);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user