LcdDisplay.HD44780.GPIO (lcd_display v0.1.2) View Source

Knows how to commuticate with HD44780 type display using GPIO pins directly. Supports the 4-bit mode only. You can turn on/off the backlight.

Usage

config = %{
  display_name: "display 1",
  pin_rs: 2,
  pin_rw: 3,
  pin_en: 4,
  pin_d4: 23,
  pin_d5: 24,
  pin_d6: 25,
  pin_d7: 26,
  pin_led: 12,
}

# Start the LCD driver and get the initial display state.
{:ok, display} = LcdDisplay.HD44780.GPIO.start(config)

# Run a command and the display state will be updated.
{:ok, display} = LcdDisplay.HD44780.GPIO.execute(display, {:print, "Hello world"})

Link to this section Summary

Types

The configuration options.

Functions

Executes the specified command and returns a new display state.

Initializes the LCD driver and returns the initial display state.

Link to this section Types

Specs

config() :: %{
  :pin_rs => pos_integer(),
  :pin_rw => pos_integer(),
  :pin_en => pos_integer(),
  :pin_d4 => pos_integer(),
  :pin_d5 => pos_integer(),
  :pin_d6 => pos_integer(),
  :pin_d7 => pos_integer(),
  :pin_led => pos_integer(),
  optional(:rows) => 1..4,
  optional(:cols) => 8..20,
  optional(:font_size) => pos_integer()
}

The configuration options.

Specs

display_driver() :: LcdDisplay.HD44780.Driver.t()

Link to this section Functions

Link to this function

execute(display, command)

View Source

Executes the specified command and returns a new display state.

Specs

start(config()) :: {:ok, display_driver()} | {:error, any()}

Initializes the LCD driver and returns the initial display state.