ex_lcd v0.3.0 ExLCD

ExLCD implements a standard API for controlling and displaying text on character matrix LCD display modules. ExLCD handles most modes and operations supported by common display modules.

ExLCD controls an assortment of displays by interacting with a driver module implementing the ExLCD.Driver behaviour. ExLCD has no direct support for controlling hardware and instead delegates low-level functions driver modules for the actual device.

Usage

ExLCD is implemented as a GenServer. Start it by calling ExLCD.start_link/1 and passing a tuple containing the name of the driver module in the first element and a map of configuration parameters in second element. See the driver module documentation for what configuration parameters it accepts.

Example:

  alias ExLCD
  ExLCD.start_link({ExLCD.HD44780, %{...}})

Summary

Functions

Clear the display

Program a custom character glyph

Disable a display feature

Enable a display feature

Home the cursor position to row 0, col 0

Move the cursor 1 or some number of columns to the left of its current position

Move the cursor 1 or some number of columns to the right of its current position

Position the cursor at a specified row and colum

Scroll the display contents left by 1 or some number of columns

Scroll the display contents right by 1 or some number of columns

Start the ExLCD GenServer to manage the display

Stop the driver and release hardware resources

Write a string or charlist to the display at the current cursor position

Types

bitmap()
bitmap() :: list
feature()
feature ::
  :display |
  :cursor |
  :blink |
  :autoscroll |
  :rtl_text |
  :ltr_text

Functions

clear()
clear() :: :ok

Clear the display.

Example:

    iex> ExLCD.clear
    :ok
create_char(idx, bits)
create_char(integer, bitmap) :: :ok

Program a custom character glyph.

Custom glyphs may not be supported by all displays. Check the driver to see if it is on yours. Pass a custome character index or slot number and a list of integers representing the glyph bitmap data. Format of the bitmap data and the numbering of the character slots is highly dependent on the display controller. Refer to the driver module for details.

Example:

    iex> ExLCD.create_char(0, [0x7F, 0x7F, 0x7F, 0x7F,
    ...>                                   0x7F, 0x7F, 0x7F, 0x7F])
    :ok
disable(atom)
disable(feature) :: :ok

Disable a display feature.

Example:

    iex> ExLCD.disable(:blink)
    :ok
enable(atom)
enable(feature) :: :ok

Enable a display feature.

Example:

    iex> ExLCD.enable(:display)
    :ok
home()
home() :: :ok

Home the cursor position to row 0, col 0

Example:

    iex> ExLCD.home
    :ok
move_left(cols \\ 1)
move_left(integer) :: :ok

Move the cursor 1 or some number of columns to the left of its current position.

Example:

    iex> ExLCD.move_left(4)
    :ok
move_right(cols \\ 1)
move_right(integer) :: :ok

Move the cursor 1 or some number of columns to the right of its current position.

Example:

    iex> ExLCD.move_right(1)
    :ok
move_to(row, col)
move_to(row :: integer, col :: integer) :: :ok

Position the cursor at a specified row and colum

Example:

    iex> ExLCD.move_to(2, 12)
    :ok
scroll_left(cols \\ 1)
scroll_left(integer) :: :ok

Scroll the display contents left by 1 or some number of columns.

Example:

  iex> ExLCD.scroll_right(6)
  :ok
scroll_right(cols \\ 1)
scroll_right(integer) :: :ok

Scroll the display contents right by 1 or some number of columns.

Example:

    iex> ExLCD.scroll_right(6)
    :ok
start_link(arg)
start_link({term, map}) :: {:ok, pid}

Start the ExLCD GenServer to manage the display.

Pass a tuple containing the name of the driver module in the first element and a map of configuration parameters in second element. See the driver module documentation for what configuration parameters it accepts.

Example:

  alias ExLCD
  ExLCD.start_link({ExLCD.HD44780, %{...}})
stop()
stop() :: :ok

Stop the driver and release hardware resources.

Example:

  iex> ExLCD.stop
  :ok
write(content)
write(binary | list) :: :ok

Write a string or charlist to the display at the current cursor position.

Example:

  iex> ExLCD.write("ExLCD!")
  :ok
  iex> ExLCD.write('ExLCD!')
  :ok
  iex> ExLCD.write(['E', 'x', 'L', 'C', 'D', '!'])
  :ok