LcdDisplay.HD44780.GPIO (lcd_display v0.3.0)

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 = %{
  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"})

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.

Types

config()

@type 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.

display_driver()

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

Functions

execute(display, command)

Executes the specified command and returns a new display state.

start(config)

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

Initializes the LCD driver and returns the initial display state.