2019-05-27 06:55:01 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2017-03-10 14:15:17 +00:00
|
|
|
/*
|
|
|
|
* Character LCD driver for Linux
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
|
|
|
|
* Copyright (C) 2016-2017 Glider bvba
|
|
|
|
*/
|
|
|
|
|
2019-08-06 07:14:45 +00:00
|
|
|
#ifndef _CHARLCD_H
|
|
|
|
#define _CHARLCD_H
|
|
|
|
|
2020-11-03 09:58:04 +00:00
|
|
|
enum charlcd_onoff {
|
|
|
|
CHARLCD_OFF = 0,
|
|
|
|
CHARLCD_ON,
|
|
|
|
};
|
|
|
|
|
2017-03-10 14:15:17 +00:00
|
|
|
struct charlcd {
|
|
|
|
const struct charlcd_ops *ops;
|
|
|
|
const unsigned char *char_conv; /* Optional */
|
|
|
|
|
|
|
|
int height;
|
|
|
|
int width;
|
|
|
|
|
2020-11-03 09:58:10 +00:00
|
|
|
/* Contains the LCD X and Y offset */
|
|
|
|
struct {
|
|
|
|
unsigned long x;
|
|
|
|
unsigned long y;
|
|
|
|
} addr;
|
|
|
|
|
2020-11-03 09:58:06 +00:00
|
|
|
void *drvdata;
|
2017-03-10 14:15:17 +00:00
|
|
|
};
|
|
|
|
|
2020-11-03 09:58:11 +00:00
|
|
|
/**
|
|
|
|
* struct charlcd_ops - Functions used by charlcd. Drivers have to implement
|
|
|
|
* these.
|
|
|
|
* @clear_fast: Clear the whole display and set cursor to position 0, 0.
|
|
|
|
* Optional.
|
|
|
|
* @backlight: Turn backlight on or off. Optional.
|
|
|
|
* @print: Print one character to the display at current cursor position.
|
|
|
|
* The buffered cursor position is advanced by charlcd. The cursor should not
|
|
|
|
* wrap to the next line at the end of a line.
|
2020-11-03 09:58:12 +00:00
|
|
|
* @gotoxy: Set cursor to x, y. The x and y values to set the cursor to are
|
|
|
|
* previously set in addr.x and addr.y by charlcd.
|
2020-11-03 09:58:13 +00:00
|
|
|
* @home: Set cursor to 0, 0. The values in addr.x and addr.y are set to 0, 0 by
|
|
|
|
* charlcd prior to calling this function.
|
2020-11-03 09:58:11 +00:00
|
|
|
*/
|
2017-03-10 14:15:17 +00:00
|
|
|
struct charlcd_ops {
|
|
|
|
void (*clear_fast)(struct charlcd *lcd);
|
2020-11-03 09:58:04 +00:00
|
|
|
void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);
|
2020-11-03 09:58:11 +00:00
|
|
|
int (*print)(struct charlcd *lcd, int c);
|
2020-11-03 09:58:12 +00:00
|
|
|
int (*gotoxy)(struct charlcd *lcd);
|
2020-11-03 09:58:13 +00:00
|
|
|
int (*home)(struct charlcd *lcd);
|
2017-03-10 14:15:17 +00:00
|
|
|
};
|
|
|
|
|
2020-11-03 09:58:06 +00:00
|
|
|
struct charlcd *charlcd_alloc(void);
|
2019-03-12 14:44:30 +00:00
|
|
|
void charlcd_free(struct charlcd *lcd);
|
2017-03-10 14:15:17 +00:00
|
|
|
|
|
|
|
int charlcd_register(struct charlcd *lcd);
|
|
|
|
int charlcd_unregister(struct charlcd *lcd);
|
|
|
|
|
|
|
|
void charlcd_poke(struct charlcd *lcd);
|
2019-08-06 07:14:45 +00:00
|
|
|
|
|
|
|
#endif /* CHARLCD_H */
|