LcdDisplay.DisplayDriver behaviour (LcdDisplay v0.0.13) 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 the display state.

Type that represents an available display feature.

Callbacks

Executes the specified command and returns a new display state.

Initializes the LCD driver and returns the initial display state.

Stops the LCD driver.

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

display() :: %{
  driver_module: atom(),
  display_name: String.t(),
  rows: integer(),
  cols: integer(),
  entry_mode: integer(),
  display_control: integer(),
  backlight: boolean()
}

Type that represents the display state.

Specs

feature() :: :entry_mode | :display_control

Type that represents an available display feature.

Link to this section Callbacks

Link to this callback

execute(display, command)

View Source

Specs

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

Executes the specified command and returns a new display state.

Specs

start(map()) :: {:ok | :error, display()}

Initializes the LCD driver and returns the initial display state.

Specs

stop(display()) :: :ok

Stops the LCD driver.