max_72xx v0.1.0 Max72XX.Array.Buffer View Source

Represents an array buffer.

This module is used to store/manipulate the bitmap data in an array.

As the array module allows to load buffers it can be useful to implement a backbuffer.

Link to this section Summary

Functions

Clear buffer (All pixels off)

Returns the buffer dimensions

Load bitmap data The bitmap needs to fit the array bitmap dimensions (array_size * 16 bytes)

Load the bitmap data from other buffer. Both buffers needs to have same dimensions.

Create new buffer

Returns the list of commands to be send to load the buffer in the device. This method is used internally by Array to transfer the data.

Link to this section Types

Link to this type

pixel_state()

View Source
pixel_state() :: boolean()
Link to this type

t()

View Source
t() :: %Max72XX.Array.Buffer{array_size: term(), data: term()}

Link to this section Functions

Link to this function

clear(buffer)

View Source
clear(buffer :: t()) :: t()

Clear buffer (All pixels off)

Link to this function

get_dimensions(buffer)

View Source
get_dimensions(buffer :: t()) :: {width :: integer(), height :: integer()}

Returns the buffer dimensions

Link to this function

load_bitmap(buffer, data)

View Source
load_bitmap(buffer :: t(), bitmap :: binary()) ::
  {:ok, t()} | {:error, :size}

Load bitmap data The bitmap needs to fit the array bitmap dimensions (array_size * 16 bytes)

Link to this function

load_buffer(buffer, src)

View Source
load_buffer(buffer :: t(), source :: t()) ::
  {:ok, t()} | {:error, :size}

Load the bitmap data from other buffer. Both buffers needs to have same dimensions.

Create new buffer

Link to this function

set_pixel(buffer, x, y, state \\ true)

View Source
set_pixel(
  buffer :: t(),
  x :: integer(),
  y :: integer(),
  state :: pixel_state()
) :: t()

Set a pixel on or off

Returns the list of commands to be send to load the buffer in the device. This method is used internally by Array to transfer the data.