hd44780 - Universal driver for HD44780 LCD display

group hd44780

ESP-IDF driver for HD44780 compatible LCD text displays.

Ported from esp-open-rtos

Copyright (C) 2016, 2018 Ruslan V. Uss unclerus@gmail.com

BSD Licensed as described in the file LICENSE

Defines

HD44780_NOT_USED

Typedefs

typedef struct hd44780 hd44780_t
typedef esp_err_t (*hd44780_write_cb_t)(const hd44780_t *lcd, uint8_t data)

Enums

enum hd44780_font_t

LCD font type.

Please refer to the datasheet of your module.

Values:

enumerator HD44780_FONT_5X8
enumerator HD44780_FONT_5X10

Functions

esp_err_t hd44780_init(const hd44780_t *lcd)

Init LCD.

Set cursor position to (0, 0)

Parameters

lcd – LCD descriptor

Returns

ESP_OK on success

esp_err_t hd44780_control(const hd44780_t *lcd, bool on, bool cursor, bool cursor_blink)

Control LCD.

On/off LCD, show/hide cursor, set cursor blink

Parameters
  • lcd – LCD descriptor

  • on – Switch LCD on if true

  • cursor – Show cursor if true

  • cursor_blink – Enable cursor blinking if true

Returns

ESP_OK on success

esp_err_t hd44780_clear(const hd44780_t *lcd)

Clear LCD.

Clear memory and move cursor to (0, 0)

Parameters

lcd – LCD descriptor

Returns

ESP_OK on success

esp_err_t hd44780_gotoxy(const hd44780_t *lcd, uint8_t col, uint8_t line)

Move cursor.

Parameters
  • lcd – LCD descriptor

  • col – Column

  • line – Line

Returns

ESP_OK on success

esp_err_t hd44780_putc(const hd44780_t *lcd, char c)

Write character at cursor position.

Parameters
  • lcd – LCD descriptor

  • c – Character to write

Returns

ESP_OK on success

esp_err_t hd44780_puts(const hd44780_t *lcd, const char *s)

Write NULL-terminated string at cursor position.

Parameters
  • lcd – LCD descriptor

  • s – String to write

Returns

ESP_OK on success

esp_err_t hd44780_switch_backlight(hd44780_t *lcd, bool on)

Switch backlight.

Parameters
  • lcd – LCD descriptor

  • on – Turn backlight on if true

Returns

ESP_OK on success

esp_err_t hd44780_upload_character(const hd44780_t *lcd, uint8_t num, const uint8_t *data)

Upload character data to the CGRAM.

After upload cursor will be moved to (0, 0).

Parameters
  • lcd – LCD descriptor

  • num – Character number (0..7)

  • data – Character data: 8 or 10 bytes depending on the font

Returns

ESP_OK on success

esp_err_t hd44780_scroll_left(const hd44780_t *lcd)

Scroll the display content to left by one character.

Parameters

lcd – LCD descriptor

Returns

ESP_OK on success

esp_err_t hd44780_scroll_right(const hd44780_t *lcd)

Scroll the display content to right by one character.

Parameters

lcd – LCD descriptor

Returns

ESP_OK on success

struct hd44780
#include <hd44780.h>

LCD descriptor.

Fill it before use.