ssd1322 v0.3.1 SSD1322 View Source

This module provides a serialized wrapper around a SSD1322.Device

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Clears the display to the specified grey level. Valid values for grey are from 0 (black) to 15 (whatever colour your display is). Defaults to 0.

Sets the contrast of the display. Valid values range from 0 (lowest contrast) to 255 (highest contrast).

Turns the display off.

Turns the display on.

Draws the specified bitmap. The bitmap must be in packed 4-bit greyscale format and the size of the full display as configured. For pixel format details see SSD1322.Device.draw.

Draws the specified bitmap at coordinates {x, y}. The bitmap must be in packed 4-bit greyscale format and the size corresponding to the specified width & height. For pixel format details see SSD1322.Device.draw.

Issues a reset to the SSD1322 device.

Starts a connection to an SSD1322 with the given parameters, wrapped in a GenServer to serialize access to the device. Returns an {:ok, pid} tuple where the pid is passed in to the other functions in this module.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Clears the display to the specified grey level. Valid values for grey are from 0 (black) to 15 (whatever colour your display is). Defaults to 0.

Link to this function

contrast(pid, contrast \\ 255)

View Source

Sets the contrast of the display. Valid values range from 0 (lowest contrast) to 255 (highest contrast).

Turns the display off.

Turns the display on.

Draws the specified bitmap. The bitmap must be in packed 4-bit greyscale format and the size of the full display as configured. For pixel format details see SSD1322.Device.draw.

Link to this function

draw(pid, bitmap, arg1, arg2)

View Source

Draws the specified bitmap at coordinates {x, y}. The bitmap must be in packed 4-bit greyscale format and the size corresponding to the specified width & height. For pixel format details see SSD1322.Device.draw.

Both x and width must be a multiple of 4.

Issues a reset to the SSD1322 device.

Starts a connection to an SSD1322 with the given parameters, wrapped in a GenServer to serialize access to the device. Returns an {:ok, pid} tuple where the pid is passed in to the other functions in this module.

Options are passed as a keyword list with the following possible values:

  • spi_connection_opts: A nested keyword list containing any of the possible values below:

    • spi_dev: The name of the spi device to connect to. Defaults to spidev0.0
    • dc_pin: The GPIO pin number of the line to use for D/C select. Defaults to 24
    • reset_pin: The GPIO pin number of the line to use for reset. Defaults to 25
  • conn: A pre-existing SSD1322.SPIConnection struct, if you already have one
  • width: The width of the display in pixels. Must be a multiple of 4. Defaults to 256
  • height: The height of the display in pixels. Defaults to 64