View Source OLEDVirtual.Format (OLEDVirtual v1.0.0)

A set of helper functions to format the frame data.

Link to this section Summary

Functions

Formats the frame data into a list of bit values. A value of 1 means the pixel is on and a value of 0 means the pixel is off.

Formats the frame data into a nested array with rows and columns. A value of 1 means the pixel is on and a value of 0 means the pixel is off.

Link to this section Functions

@spec as_bits(data :: binary()) :: [0 | 1]

Formats the frame data into a list of bit values. A value of 1 means the pixel is on and a value of 0 means the pixel is off.

{:ok, frame} = MyApp.MyDisplay.get_frame()

bits = OLEDVirtual.Format.as_bits(frame)
@spec as_matrix(data :: binary(), width :: pos_integer()) :: [[0 | 1]]

Formats the frame data into a nested array with rows and columns. A value of 1 means the pixel is on and a value of 0 means the pixel is off.

{:ok, width, _height} = MyApp.MyDisplay.get_dimensions()
{:ok, frame} = MyApp.MyDisplay.get_frame()

pixel_matrix = OLEDVirtual.Format.as_matrix(frame, width)