hd44780 - Universal driver for HD44780 LCD display

group hd44780

ESP-IDF driver for HD44780 compartible 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)

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

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.

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

  • on: Switch LCD on if true

  • cursor: Show cursor if true

  • cursor_blink: Enable cursor blinking if true

esp_err_t hd44780_clear(const hd44780_t *lcd)

Clear LCD Clear memory and move cursor to (0, 0)

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

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

Move cursor.

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

  • col: Column

  • line: Line

esp_err_t hd44780_putc(const hd44780_t *lcd, char c)

Write character at cursor position.

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

  • c: Character to write

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

Write NULL-terminated string at cursor position.

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

  • s: String to write

esp_err_t hd44780_switch_backlight(hd44780_t *lcd, bool on)

Switch backlight.

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

  • on: Turn backlight on if true

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

Upload character data to the CGRAM.

Cursor position will be moved to (0, 0) after uploading

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

  • num: Character number (0..7)

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

esp_err_t hd44780_scroll_left(const hd44780_t *lcd)

Scroll the display content to left by one character.

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

esp_err_t hd44780_scroll_right(const hd44780_t *lcd)

Scroll the display content to right by one character.

Return

ESP_OK on success

Parameters
  • lcd: LCD descriptor

struct hd44780
#include <hd44780.h>

LCD descriptor.

Fill it before use.