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