HD44780 LCD driver

Driver for the Hitachi HD44780 LCD driver. More...

Detailed Description

Driver for the Hitachi HD44780 LCD driver.

Note
The driver currently supports direct addressing, no I2C

Files

file  hd44780_internal.h
 Internal config and parameters for the HD44780 display.
 
file  hd44780_params.h
 Pinout config for the HD44780 display.
 
file  hd44780.h
 Interface definition for the HD44780 LCD driver.
 

Data Structures

struct  hd44780_params_t
 Parameters needed for device initialization. More...
 
struct  hd44780_t
 Device descriptor for HD44780 LCD. More...
 

Macros

#define HD44780_MAX_COLS   (40U)
 Maximal number of columns supported by the driver.
 
#define HD44780_MAX_ROWS   (4U)
 Maximal number of rows supported by the driver.
 
#define HD44780_MAX_PINS   (8U)
 Number of data pins for communication 4 or 8.
 
#define HD44780_CGRAM_SIZE   (8U)
 Size of RAM for custom chars. More...
 

Enumerations

enum  hd44780_state_t { HD44780_OFF, HD44780_ON }
 Simple state values. More...
 

Functions

int hd44780_init (hd44780_t *dev, const hd44780_params_t *params)
 Initialize the given driver. More...
 
void hd44780_clear (const hd44780_t *dev)
 Clear display, delete all chars. More...
 
void hd44780_home (const hd44780_t *dev)
 Reset cursor to row 0 and column 0. More...
 
void hd44780_set_cursor (const hd44780_t *dev, uint8_t col, uint8_t row)
 Set cursor to specific position in column and row. More...
 
void hd44780_display (hd44780_t *dev, hd44780_state_t state)
 Turn display on or off. More...
 
void hd44780_cursor (hd44780_t *dev, hd44780_state_t state)
 Show cursor, on or off. More...
 
void hd44780_blink (hd44780_t *dev, hd44780_state_t state)
 Blink cursor, on or off. More...
 
void hd44780_scroll_left (const hd44780_t *dev)
 Enable left scrolling. More...
 
void hd44780_scroll_right (const hd44780_t *dev)
 Enable right scrolling. More...
 
void hd44780_left2right (hd44780_t *dev)
 Set display direction left to right. More...
 
void hd44780_right2left (hd44780_t *dev)
 Set display direction right to left. More...
 
void hd44780_autoscroll (hd44780_t *dev, hd44780_state_t state)
 Display autoscroll on or off. More...
 
void hd44780_create_char (const hd44780_t *dev, uint8_t location, uint8_t charmap[])
 Create and store a custom character on display memory. More...
 
void hd44780_write (const hd44780_t *dev, uint8_t value)
 Write a single character on the LCD. More...
 
void hd44780_print (const hd44780_t *dev, const char *data)
 Write a string on the LCD. More...
 

Macro Definition Documentation

◆ HD44780_CGRAM_SIZE

#define HD44780_CGRAM_SIZE   (8U)

Size of RAM for custom chars.

Generally the driver could support 8 chars of size 5x8 or 4 of size 5x10. However, most displays only use the former, which is (hard wired) default.

Definition at line 55 of file hd44780.h.

Enumeration Type Documentation

◆ hd44780_state_t

Simple state values.

Enumerator
HD44780_OFF 

disable feature

HD44780_ON 

enable feature

Definition at line 83 of file hd44780.h.

Function Documentation

◆ hd44780_autoscroll()

void hd44780_autoscroll ( hd44780_t dev,
hd44780_state_t  state 
)

Display autoscroll on or off.

Parameters
[in]devdevice descriptor of LCD
[in]statescroll on or off

◆ hd44780_blink()

void hd44780_blink ( hd44780_t dev,
hd44780_state_t  state 
)

Blink cursor, on or off.

Parameters
[in]devdevice descriptor of LCD
[in]stateblink on or off

◆ hd44780_clear()

void hd44780_clear ( const hd44780_t dev)

Clear display, delete all chars.

Parameters
[in]devdevice descriptor of LCD

◆ hd44780_create_char()

void hd44780_create_char ( const hd44780_t dev,
uint8_t  location,
uint8_t  charmap[] 
)

Create and store a custom character on display memory.

Parameters
[in]devdevice descriptor of LCD
[in]locationmemory location
[in]charmapcharacter bitmap
Precondition
charmap has to be of size HD44780_CGRAM_SIZE, which is 8 by default

◆ hd44780_cursor()

void hd44780_cursor ( hd44780_t dev,
hd44780_state_t  state 
)

Show cursor, on or off.

Parameters
[in]devdevice descriptor of LCD
[in]statecursor on or off

◆ hd44780_display()

void hd44780_display ( hd44780_t dev,
hd44780_state_t  state 
)

Turn display on or off.

Parameters
[in]devdevice descriptor of LCD
[in]statedisplay on or off

◆ hd44780_home()

void hd44780_home ( const hd44780_t dev)

Reset cursor to row 0 and column 0.

Parameters
[in]devdevice descriptor of LCD

◆ hd44780_init()

int hd44780_init ( hd44780_t dev,
const hd44780_params_t params 
)

Initialize the given driver.

Parameters
[out]devdevice descriptor of display to initialize
[in]paramsconfiguration parameters
Returns
0 on success, otherwise error

◆ hd44780_left2right()

void hd44780_left2right ( hd44780_t dev)

Set display direction left to right.

Parameters
[in]devdevice descriptor of LCD

◆ hd44780_print()

void hd44780_print ( const hd44780_t dev,
const char *  data 
)

Write a string on the LCD.

Parameters
[in]devdevice descriptor of LCD
[in]datathe string to print

◆ hd44780_right2left()

void hd44780_right2left ( hd44780_t dev)

Set display direction right to left.

Parameters
[in]devdevice descriptor of LCD

◆ hd44780_scroll_left()

void hd44780_scroll_left ( const hd44780_t dev)

Enable left scrolling.

Parameters
[in]devdevice descriptor of LCD

◆ hd44780_scroll_right()

void hd44780_scroll_right ( const hd44780_t dev)

Enable right scrolling.

Parameters
[in]devdevice descriptor of LCD

◆ hd44780_set_cursor()

void hd44780_set_cursor ( const hd44780_t dev,
uint8_t  col,
uint8_t  row 
)

Set cursor to specific position in column and row.

Parameters
[in]devdevice descriptor of LCD
[in]colcolumn position
[in]rowrow position

◆ hd44780_write()

void hd44780_write ( const hd44780_t dev,
uint8_t  value 
)

Write a single character on the LCD.

Parameters
[in]devdevice descriptor of LCD
[in]valuethe character to print, i.e., memory location