1
2
3
4
5
6
7
8
9#ifndef _CHARLCD_H
10#define _CHARLCD_H
11
12#define LCD_FLAG_B 0x0004
13#define LCD_FLAG_C 0x0008
14#define LCD_FLAG_D 0x0010
15#define LCD_FLAG_F 0x0020
16#define LCD_FLAG_N 0x0040
17#define LCD_FLAG_L 0x0080
18
19enum charlcd_onoff {
20 CHARLCD_OFF = 0,
21 CHARLCD_ON,
22};
23
24enum charlcd_shift_dir {
25 CHARLCD_SHIFT_LEFT,
26 CHARLCD_SHIFT_RIGHT,
27};
28
29enum charlcd_fontsize {
30 CHARLCD_FONTSIZE_SMALL,
31 CHARLCD_FONTSIZE_LARGE,
32};
33
34enum charlcd_lines {
35 CHARLCD_LINES_1,
36 CHARLCD_LINES_2,
37};
38
39struct charlcd {
40 const struct charlcd_ops *ops;
41 const unsigned char *char_conv;
42
43 int height;
44 int width;
45
46
47 struct {
48 unsigned long x;
49 unsigned long y;
50 } addr;
51
52 void *drvdata;
53};
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78struct charlcd_ops {
79 void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);
80 int (*print)(struct charlcd *lcd, int c);
81 int (*gotoxy)(struct charlcd *lcd, unsigned int x, unsigned int y);
82 int (*home)(struct charlcd *lcd);
83 int (*clear_display)(struct charlcd *lcd);
84 int (*init_display)(struct charlcd *lcd);
85 int (*shift_cursor)(struct charlcd *lcd, enum charlcd_shift_dir dir);
86 int (*shift_display)(struct charlcd *lcd, enum charlcd_shift_dir dir);
87 int (*display)(struct charlcd *lcd, enum charlcd_onoff on);
88 int (*cursor)(struct charlcd *lcd, enum charlcd_onoff on);
89 int (*blink)(struct charlcd *lcd, enum charlcd_onoff on);
90 int (*fontsize)(struct charlcd *lcd, enum charlcd_fontsize size);
91 int (*lines)(struct charlcd *lcd, enum charlcd_lines lines);
92 int (*redefine_char)(struct charlcd *lcd, char *esc);
93};
94
95void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on);
96struct charlcd *charlcd_alloc(void);
97void charlcd_free(struct charlcd *lcd);
98
99int charlcd_register(struct charlcd *lcd);
100int charlcd_unregister(struct charlcd *lcd);
101
102void charlcd_poke(struct charlcd *lcd);
103
104#endif
105