1 /* This is the LCDproc driver for various serial VFD Devices
3 Copyright (C) 2006 Stefan Herdler
5 This driver is based on wirz-sli.c, hd44780.c, drv_base.c and NoritakeVFD
7 It may contain parts of other drivers of this package too.
9 2006-05-16 Version 0.3: everything should work (not all hardware tested!)
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 */
28 #include "adv_bignum.h"
29 #include "serialVFD_displays.h"
30 #include "serialVFD_io.h"
32 #define CCMODE_STANDARD 0 /* only char 0 is used for heartbeat */
35 #define CCMODE_BIGNUM 3
36 #define CCMODE_BIGCHAR 4
37 #define CCMODE_CUSTOM 5
40 #define DEFAULT_CELL_WIDTH 5
41 #define DEFAULT_CELL_HEIGHT 7
42 #define DEFAULT_DEVICE "/dev/lcd"
43 #define DEFAULT_SPEED 9600
44 #define DEFAULT_BRIGHTNESS 140
45 #define DEFAULT_SIZE "20x2"
46 #define DEFAULT_DISPLAYTYPE 0
49 MODULE_EXPORT
int serialVFD_init (Driver
*drvthis
);
50 MODULE_EXPORT
void serialVFD_close (Driver
*drvthis
);
51 MODULE_EXPORT
int serialVFD_width (Driver
*drvthis
);
52 MODULE_EXPORT
int serialVFD_height (Driver
*drvthis
);
53 MODULE_EXPORT
int serialVFD_cellwidth (Driver
*drvthis
);
54 MODULE_EXPORT
int serialVFD_cellheight (Driver
*drvthis
);
55 MODULE_EXPORT
void serialVFD_clear (Driver
*drvthis
);
56 MODULE_EXPORT
void serialVFD_flush (Driver
*drvthis
);
57 MODULE_EXPORT
void serialVFD_string (Driver
*drvthis
, int x
, int y
, const char string
[]);
58 MODULE_EXPORT
void serialVFD_chr (Driver
*drvthis
, int x
, int y
, char c
);
60 MODULE_EXPORT
void serialVFD_vbar (Driver
*drvthis
, int x
, int y
, int len
, int promille
, int options
);
61 MODULE_EXPORT
void serialVFD_hbar (Driver
*drvthis
, int x
, int y
, int len
, int promille
, int options
);
62 MODULE_EXPORT
int serialVFD_icon(Driver
*drvthis
, int x
, int y
, int icon
);
64 MODULE_EXPORT
void serialVFD_set_char (Driver
*drvthis
, int n
, unsigned char *dat
);
66 MODULE_EXPORT
int serialVFD_get_brightness (Driver
*drvthis
, int state
);
67 MODULE_EXPORT
void serialVFD_set_brightness (Driver
*drvthis
, int state
, int promille
);
68 MODULE_EXPORT
void serialVFD_backlight (Driver
*drvthis
, int on
);
69 MODULE_EXPORT
void serialVFD_output (Driver
*drvthis
, int state
);
70 MODULE_EXPORT
void serialVFD_num (Driver
*drvthis
, int x
, int num
);
71 MODULE_EXPORT
int serialVFD_get_free_chars (Driver
*drvthis
);
72 MODULE_EXPORT
const char * serialVFD_get_info( Driver
*drvthis
);
74 typedef struct driver_private_data
{
75 int use_parallel
; // use parallel?
76 unsigned short port
; // Port in parallel mode
77 char device
[200]; // Device in serial mode
79 int speed
; // Speed in serial mode
82 int cellwidth
, cellheight
;
83 /* framebuffer and buffer for old LCD contents */
84 unsigned char *framebuf
;
85 unsigned char *backingstore
;
86 /* defineable characters */
95 unsigned int refresh_timer
;
96 unsigned char charmap
[128];
97 int display_type
; // display type
98 int last_custom
; // last custom character written
99 unsigned char custom_char
[31][7]; // stored custom characters
100 unsigned char custom_char_store
[31][7]; // custom characters backingstore
101 unsigned char hw_cmd
[10][4]; // hardwarespecific commands
102 int usr_chr_dot_assignment
[57]; // how to setup usercharacters
103 unsigned int usr_chr_mapping
[31];// where to place the usercharacters (0..30) in the asciicode
104 int hbar_cc_offset
; // character offset of the bars
105 int vbar_cc_offset
; // character offset of the bars