LcdDisplay.DisplayDriver behaviour (LcdDisplay v0.0.9) 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()}
  | {:write, charlist()}
  | {:set_cursor, integer(), integer()}
  | {:cursor, boolean()}
  | {:blink, boolean()}
  | {:display, boolean()}
  | {:autoscroll, boolean()}
  | {:backlight, boolean()}
  | :entry_right_to_left
  | :entry_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.
:writewrite a character (byte) at the current cursor.
:set_cursorMove the cursor to the specified position (column and row).
:cursorSwitch on/off the underline cursor.
:displaySwitch on/off the display.
:blinkSwitch on/off the block cursor.
:autoscrollAutomatically scroll the display when a charactor is written.
:backlightSwitch on/off the backlight.
:entry_right_to_leftText is printed from right to left.
:entry_left_to_rightText is printed from left to right.
:scrollScroll left/right the display.
:leftMove the cursor left.
:rightMove the cursor right.
:charProgram custom character to CGRAM.

Specs

display() :: %{
  driver_module: atom(),
  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 | :error, display()}

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.