LcdDisplay.Driver behaviour (lcd_display v0.0.17) View Source

Defines a behaviour required for an LCD driver.

Link to this section Summary

Types

Type that represents a supported display command.

Type that represents an available display feature.

t()

Type that represents the display state.

Callbacks

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

command() ::
  :clear
  | :home
  | {:print, String.t()}
  | {:set_cursor, integer(), integer()}
  | {:cursor, boolean()}
  | {:blink, boolean()}
  | {:display, boolean()}
  | {:autoscroll, boolean()}
  | {:backlight, boolean()}
  | {:text_direction, :right_to_left}
  | {:text_direction, :left_to_right}
  | {:scroll, integer()}
  | {:left, integer()}
  | {:right, integer()}
  | {:char, integer(), byte()}

Type that represents a supported display command.

Supported CommandDescription
:clearClear the display.
:homeMove the cursor home.
:printPrint a text at the current cursor.
:set_cursorSet the cursor position (row and column).
:cursorSwitch on/off the underline cursor.
:displaySwitch on/off the display without losing what is on it.
:blinkSwitch on/off the block cursor.
:autoscrollMake existing text shift when new text is printed.
:backlightSwitch on/off the backlight.
:text_directionMake text flow left/right from the cursor.
:scrollScroll text left and right.
:leftMove the cursor left.
:rightMove the cursor right.
:charProgram custom character to CGRAM.

Specs

config() :: map()

Specs

feature() :: :entry_mode | :display_control

Type that represents an available display feature.

Specs

num_cols() :: 8..20

Specs

num_rows() :: 1..4

Specs

t() :: %{
  :driver_module => atom(),
  :display_name => any(),
  :rows => num_rows(),
  :cols => num_cols(),
  :entry_mode => byte(),
  :display_control => byte(),
  :backlight => boolean(),
  required(atom()) => any()
}

Type that represents the display state.

Link to this section Callbacks

Specs

execute(t(), command()) :: {:ok, t()} | {:error, any()}

Executes the specified command and returns a new display state.

Specs

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

Initializes the LCD driver and returns the initial display state.