LcdDisplay.HD44780.Driver behaviour (lcd_display v0.3.0)
View SourceDefines a behaviour required for an LCD driver.
Summary
Types
Type that represents a supported display command. Some driver modules do not support the backlight LED commands.
Type that represents an available display feature.
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.
Sends a data byte to the display.
Sends an instruction byte to the display.
Functions
Injects the common logic for an LCD driver. For display flags, please refer to HD44780 data sheet.
Types
@type command() :: :clear | :home | {:print, String.t() | byte()} | {:set_cursor, integer(), integer()} | {:cursor, boolean()} | {:blink, boolean()} | {:display, boolean()} | {:autoscroll, boolean()} | {:text_direction, :right_to_left} | {:text_direction, :left_to_right} | {:scroll, integer()} | {:left, integer()} | {:right, integer()} | {:backlight, boolean()} | {:red, boolean()} | {:green, boolean()} | {:blue, boolean()}
Type that represents a supported display command. Some driver modules do not support the backlight LED commands.
| Supported Command | Description |
|---|---|
:clear | Clear the display. |
:home | Move the cursor home. |
:print | Print a character or text at the current cursor. |
:set_cursor | Set the cursor position (row and column). |
:cursor | Switch on/off the underline cursor. |
:display | Switch on/off the display without losing what is on it. |
:blink | Switch on/off the block cursor. |
:autoscroll | Make existing text shift when new text is printed. |
:text_direction | Make text flow left/right from the cursor. |
:scroll | Scroll text left and right. |
:left | Move the cursor left. |
:right | Move the cursor right. |
:backlight | Switch on/off the backlight. |
:red | Switch on/off the red LED. |
:green | Switch on/off the green LED. |
:blue | Switch on/off the blue LED. |
@type config() :: map()
@type feature() :: :entry_mode | :display_control
Type that represents an available display feature.
@type num_cols() :: 8..20
@type num_rows() :: 1..4
@type t() :: %{ :driver_module => atom(), :rows => num_rows(), :cols => num_cols(), :entry_mode => byte(), :display_control => byte(), :backlight => boolean(), required(atom()) => any() }
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.
Sends a data byte to the display.
Sends an instruction byte to the display.
Functions
Injects the common logic for an LCD driver. For display flags, please refer to HD44780 data sheet.
Examples
use LcdDisplay.HD44780.Driver