ssd1322 v0.3.1 SSD1322.Device View Source

This module provides a high-level interface to control and display content on a SSD1322 based OLED display.

Note that this module is stateless - there is no protection here at all for concurrent access

For details regarding the magic values used herein, consult the SSD1322 datasheet

Link to this section Summary

Functions

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.

Sets up a connection to an SSD1322. Returns an opaque struct of type SSD1322.Device suitable for passing to other functions in this module.

Issues a reset to the SSD1322 device.

Link to this section Functions

Link to this function

clear(device, grey \\ 0)

View Source

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(device, contrast)

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.

Link to this function

draw(device, binary, arg1, arg2)

View Source

Draws the specified bitmap. The bitmap must be in packed 4-bit greyscale format and the size of the full display as configured.

The pixel format is packed 4-bit greyscale in the following format

  • Row length must be a multiple of 4
  • Each pixel is represented by 4 bits from 0 (fully off) to 15 (fully on)
  • Pixels are packed 2 per byte, in left-to-right order
  • Rows are packed in top-to-bottom order

This function does not perform any clipping or validation on the given binary other than to other than to validate that its x offset and width are both multiples of 4.

Sets up a connection to an SSD1322. Returns an opaque struct of type SSD1322.Device suitable for passing to 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

Issues a reset to the SSD1322 device.