2019-05-27 09:55:01 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2017-03-10 17:15:17 +03:00
|
|
|
/*
|
|
|
|
* Character LCD driver for Linux
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
|
|
|
|
* Copyright (C) 2016-2017 Glider bvba
|
|
|
|
*/
|
|
|
|
|
2019-08-06 10:14:45 +03:00
|
|
|
#ifndef _CHARLCD_H
|
|
|
|
#define _CHARLCD_H
|
|
|
|
|
2020-11-03 12:58:04 +03:00
|
|
|
enum charlcd_onoff {
|
|
|
|
CHARLCD_OFF = 0,
|
|
|
|
CHARLCD_ON,
|
|
|
|
};
|
|
|
|
|
2017-03-10 17:15:17 +03:00
|
|
|
struct charlcd {
|
|
|
|
const struct charlcd_ops *ops;
|
|
|
|
const unsigned char *char_conv; /* Optional */
|
|
|
|
|
|
|
|
int height;
|
|
|
|
int width;
|
|
|
|
|
2020-11-03 12:58:10 +03:00
|
|
|
/* Contains the LCD X and Y offset */
|
|
|
|
struct {
|
|
|
|
unsigned long x;
|
|
|
|
unsigned long y;
|
|
|
|
} addr;
|
|
|
|
|
2020-11-03 12:58:06 +03:00
|
|
|
void *drvdata;
|
2017-03-10 17:15:17 +03:00
|
|
|
};
|
|
|
|
|
2020-11-03 12:58:11 +03: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 12:58:12 +03: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 12:58:13 +03: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 12:58:14 +03:00
|
|
|
* @clear_display: Again clear the whole display, set the 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 12:58:11 +03:00
|
|
|
*/
|
2017-03-10 17:15:17 +03:00
|
|
|
struct charlcd_ops {
|
|
|
|
void (*clear_fast)(struct charlcd *lcd);
|
2020-11-03 12:58:04 +03:00
|
|
|
void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);
|
2020-11-03 12:58:11 +03:00
|
|
|
int (*print)(struct charlcd *lcd, int c);
|
2020-11-03 12:58:12 +03:00
|
|
|
int (*gotoxy)(struct charlcd *lcd);
|
2020-11-03 12:58:13 +03:00
|
|
|
int (*home)(struct charlcd *lcd);
|
2020-11-03 12:58:14 +03:00
|
|
|
int (*clear_display)(struct charlcd *lcd);
|
2017-03-10 17:15:17 +03:00
|
|
|
};
|
|
|
|
|
2020-11-03 12:58:06 +03:00
|
|
|
struct charlcd *charlcd_alloc(void);
|
2019-03-12 17:44:30 +03:00
|
|
|
void charlcd_free(struct charlcd *lcd);
|
2017-03-10 17:15:17 +03:00
|
|
|
|
|
|
|
int charlcd_register(struct charlcd *lcd);
|
|
|
|
int charlcd_unregister(struct charlcd *lcd);
|
|
|
|
|
|
|
|
void charlcd_poke(struct charlcd *lcd);
|
2019-08-06 10:14:45 +03:00
|
|
|
|
|
|
|
#endif /* CHARLCD_H */
|