0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _CHARLCD_H
0010 #define _CHARLCD_H
0011
0012 #define LCD_FLAG_B 0x0004
0013 #define LCD_FLAG_C 0x0008
0014 #define LCD_FLAG_D 0x0010
0015 #define LCD_FLAG_F 0x0020
0016 #define LCD_FLAG_N 0x0040
0017 #define LCD_FLAG_L 0x0080
0018
0019 enum charlcd_onoff {
0020 CHARLCD_OFF = 0,
0021 CHARLCD_ON,
0022 };
0023
0024 enum charlcd_shift_dir {
0025 CHARLCD_SHIFT_LEFT,
0026 CHARLCD_SHIFT_RIGHT,
0027 };
0028
0029 enum charlcd_fontsize {
0030 CHARLCD_FONTSIZE_SMALL,
0031 CHARLCD_FONTSIZE_LARGE,
0032 };
0033
0034 enum charlcd_lines {
0035 CHARLCD_LINES_1,
0036 CHARLCD_LINES_2,
0037 };
0038
0039 struct charlcd {
0040 const struct charlcd_ops *ops;
0041 const unsigned char *char_conv;
0042
0043 int height;
0044 int width;
0045
0046
0047 struct {
0048 unsigned long x;
0049 unsigned long y;
0050 } addr;
0051
0052 void *drvdata;
0053 };
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 struct charlcd_ops {
0079 void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);
0080 int (*print)(struct charlcd *lcd, int c);
0081 int (*gotoxy)(struct charlcd *lcd, unsigned int x, unsigned int y);
0082 int (*home)(struct charlcd *lcd);
0083 int (*clear_display)(struct charlcd *lcd);
0084 int (*init_display)(struct charlcd *lcd);
0085 int (*shift_cursor)(struct charlcd *lcd, enum charlcd_shift_dir dir);
0086 int (*shift_display)(struct charlcd *lcd, enum charlcd_shift_dir dir);
0087 int (*display)(struct charlcd *lcd, enum charlcd_onoff on);
0088 int (*cursor)(struct charlcd *lcd, enum charlcd_onoff on);
0089 int (*blink)(struct charlcd *lcd, enum charlcd_onoff on);
0090 int (*fontsize)(struct charlcd *lcd, enum charlcd_fontsize size);
0091 int (*lines)(struct charlcd *lcd, enum charlcd_lines lines);
0092 int (*redefine_char)(struct charlcd *lcd, char *esc);
0093 };
0094
0095 void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on);
0096 struct charlcd *charlcd_alloc(void);
0097 void charlcd_free(struct charlcd *lcd);
0098
0099 int charlcd_register(struct charlcd *lcd);
0100 int charlcd_unregister(struct charlcd *lcd);
0101
0102 void charlcd_poke(struct charlcd *lcd);
0103
0104 #endif