blob: a16aa8c29c992048fb1103b6e55e1248b13b965a [file] [log] [blame]
Lars Poeschel718e05e2020-11-03 10:58:05 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
Lars Poeschel2545c1c2020-11-03 10:58:06 +01003#define DEFAULT_LCD_BWIDTH 40
4#define DEFAULT_LCD_HWIDTH 64
5
Lars Poeschel718e05e2020-11-03 10:58:05 +01006struct hd44780_common {
Lars Poeschel3fc04dd2020-11-03 10:58:07 +01007 int ifwidth; /* 4-bit or 8-bit (default) */
Lars Poeschel2545c1c2020-11-03 10:58:06 +01008 int bwidth; /* Default set by hd44780_alloc() */
9 int hwidth; /* Default set by hd44780_alloc() */
Lars Poeschel01ec46d2020-11-03 10:58:17 +010010 unsigned long hd44780_common_flags;
Lars Poeschel71ff7012020-11-03 10:58:08 +010011 void (*write_data)(struct hd44780_common *hdc, int data);
Lars Poeschel2c6a82f2020-11-03 10:58:09 +010012 void (*write_cmd)(struct hd44780_common *hdc, int cmd);
13 /* write_cmd_raw4 is for 4-bit connected displays only */
14 void (*write_cmd_raw4)(struct hd44780_common *hdc, int cmd);
Lars Poeschel718e05e2020-11-03 10:58:05 +010015 void *hd44780;
16};
17
Lars Poeschelb26deab2020-11-03 10:58:11 +010018int hd44780_common_print(struct charlcd *lcd, int c);
Lars Poeschel40c2b722020-11-03 10:58:25 +010019int hd44780_common_gotoxy(struct charlcd *lcd, unsigned int x, unsigned int y);
Lars Poeschel88645a82020-11-03 10:58:13 +010020int hd44780_common_home(struct charlcd *lcd);
Lars Poeschel45421ff2020-11-03 10:58:14 +010021int hd44780_common_clear_display(struct charlcd *lcd);
Lars Poeschel01ec46d2020-11-03 10:58:17 +010022int hd44780_common_init_display(struct charlcd *lcd);
Lars Poescheld2f21872020-11-03 10:58:18 +010023int hd44780_common_shift_cursor(struct charlcd *lcd,
24 enum charlcd_shift_dir dir);
25int hd44780_common_shift_display(struct charlcd *lcd,
26 enum charlcd_shift_dir dir);
27int hd44780_common_display(struct charlcd *lcd, enum charlcd_onoff on);
28int hd44780_common_cursor(struct charlcd *lcd, enum charlcd_onoff on);
29int hd44780_common_blink(struct charlcd *lcd, enum charlcd_onoff on);
30int hd44780_common_fontsize(struct charlcd *lcd, enum charlcd_fontsize size);
31int hd44780_common_lines(struct charlcd *lcd, enum charlcd_lines lines);
Lars Poeschel339acb02020-11-03 10:58:20 +010032int hd44780_common_redefine_char(struct charlcd *lcd, char *esc);
Lars Poeschel718e05e2020-11-03 10:58:05 +010033struct hd44780_common *hd44780_common_alloc(void);