LcdDisplay.HD44780.SN74HC595 (lcd_display v0.2.0) View Source

Knows how to commuticate with HD44780 type display through the 8-bit shift register SN74HC595. You can turn on/off the backlight.

Usage

iex> Circuits.SPI.bus_names()
["spidev0.0", "spidev0.1"]
config = %{
  spi_bus: "spidev0.0",      # SPI bus name
  rows: 2,                   # the number of display rows
  cols: 16,                  # the number of display columns
  font_size: "5x8"           # "5x10" or "5x8"
}

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

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

Pin assignment

This module assumes the following pin assignment:

SN74HC595HD44780
QA-
QBRS (Register Select)
QCE (Enable)
QDDB7 (Data Bus 7)
QEDB6 (Data Bus 6)
QFDB5 (Data Bus 5)
QGDB4 (Data Bus 4)
QHLED

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() :: %{
  optional(:rows) => String.t(),
  optional(:cols) => pos_integer(),
  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.