LcdDisplay.HD44780.MCP23008 (lcd_display v0.0.18) View Source
Knows how to commuticate with HD44780 type display through the 8-Bit I/O Expander with Serial Interface MCP23008. You can turn on/off the backlight.
Usage
iex(2)> Circuits.I2C.detect_devices
Devices on I2C bus "i2c-1":
* 32 (0x20)
1 devices detected on 1 I2C busesconfig = %{
display_name: "display 1", # the identifier
i2c_bus: "i2c-1", # I2C bus name
i2c_address: 0x20, # 7-bit address
rows: 2, # the number of display rows
cols: 16, # the number of display columns
font_size: "5x8" # "5x10" or "5x8"
}
# Start the LCD driver and get the initial display state.
{:ok, display} = LcdDisplay.HD44780.MCP23008.start(config)
# Run a command and the display state will be updated.
{:ok, display} = LcdDisplay.HD44780.MCP23008.execute(display, {:print, "Hello world"})MCP23008
pin assignment
This module assumes the following pin assignment:
| MCP23008 | HD44780 |
|---|---|
| GP0 | - |
| GP1 | RS (Register Select) |
| GP2 | E (Enable) |
| GP3 | DB4 (Data Bus 4) |
| GP4 | DB5 (Data Bus 5) |
| GP5 | DB6 (Data Bus 6) |
| GP6 | DB7 (Data Bus 7) |
| GP7 | LED |
Link to this section Summary
Functions
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
config() :: %{
optional(:rows) => String.t(),
optional(:cols) => pos_integer(),
optional(:font_size) => pos_integer()
}
The configuration options.
Link to this section Functions
Executes the specified command and returns a new display state.
Specs
start(config()) :: {:ok, LcdDisplay.Driver.t()} | {:error, any()}
Initializes the LCD driver and returns the initial display state.