1
/* This file is part the LCDproc driver for various serial VFD Devices.
3
It contains the hardwaredependent commands ach characterset.
5
If you want to add a new device to the driver add a new section
6
to the displaytype-switch-case in the init-function, add a new load_...
7
function below and fill it with the corrrect commands for the display.
8
(Try wich displaytype works best with your display, copy and modify
9
it's section that is the easiest way I guess.)
11
Copyright (C) 2006 Stefan Herdler
13
2006-05-15 Version 0.3: everything should work (not all hardware tested!)
15
This program is free software; you can redistribute it and/or modify
16
it under the terms of the GNU General Public License as published by
17
the Free Software Foundation; either version 2 of the License, or
20
This program is distributed in the hope that it will be useful,
21
but WITHOUT ANY WARRANTY; without even the implied warranty of
22
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
GNU General Public License for more details.
25
You should have received a copy of the GNU General Public License
26
along with this program; if not, write to the Free Software
27
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
33
#include "serialVFD_io.h"
34
#include "serialVFD.h"
44
serialVFD_write_serial (Driver *drvthis, char *dat, size_t length)
46
PrivateData *p = drvthis->private_data;
47
write (p->fd,dat,length);
51
serialVFD_write_parallel (Driver *drvthis, char *dat, size_t length)
53
PrivateData *p = drvthis->private_data;
56
for(i_para = 0; i_para < length; i_para++) {
57
port_out(p->port, dat[i_para]);
59
port_out(p->port+2, WR_on);
61
port_out(p->port+2, WR_off);
63
for(j_para=0; j_para < MAXBUSY; j_para++) {
64
if((port_in(p->port+1)) & Busy)
71
serialVFD_init_serial (Driver *drvthis)
73
PrivateData *p = drvthis->private_data;
74
struct termios portset;
76
/* Set up io port correctly, and open it...*/
77
debug( RPT_DEBUG, "%s: Opening device: %s", __FUNCTION__, p->device);
78
p->fd = open (p->device, O_RDWR | O_NOCTTY | O_NDELAY);
81
report (RPT_ERR, "%s: open() of %s failed (%s)\n", __FUNCTION__, p->device, strerror (errno));
85
tcgetattr (p->fd, &portset);
90
cfmakeraw( &portset );
93
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
94
| INLCR | IGNCR | ICRNL | IXON );
95
portset.c_oflag &= ~OPOST;
96
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
97
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
98
portset.c_cflag |= CS8 | CREAD | CLOCAL ;
102
cfsetospeed (&portset, p->speed);
103
cfsetispeed (&portset, B0);
106
tcsetattr (p->fd, TCSANOW, &portset);
111
serialVFD_init_parallel (Driver *drvthis)
114
PrivateData *p = drvthis->private_data;
115
debug( RPT_DEBUG, "%s: Opening parallelport at: 0x%X", __FUNCTION__, p->port);
116
// if(port_access_multiple(p->port,3)) return -1;
117
if(port_access(p->port) != 0) ret=-1;
118
if(port_access(p->port+1) != 0) ret=-1;
119
if(port_access(p->port+2) != 0) ret=-1;
121
report (RPT_ERR, "%s: port_access() of 0x%X failed (%s)\n", __FUNCTION__, p->port, strerror (errno));