adafruit_matrixportal.matrix

Helper library for the MatrixPortal M4 or Adafruit RGB Matrix Shield + Metro M4 Airlift Lite.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_matrixportal.matrix.Matrix(*, width=64, height=32, bit_depth=2, alt_addr_pins=None, color_order='RGB', serpentine=True, tile_rows=1, rotation=0)

Class representing the Adafruit RGB Matrix. This is used to automatically initialize the display.

Parameters
  • width (int) – The width of the display in Pixels. Defaults to 64.

  • height (int) – The height of the display in Pixels. Defaults to 32.

  • bit_depth (int) – The number of bits per color channel. Defaults to 2.

  • alt_addr_pins (list) – An alternate set of address pins to use. Defaults to None

  • color_order (string) – A string containing the letter “R”, “G”, and “B” in the order you want. Defaults to “RGB”

  • width – The total width of the display(s) in Pixels. Defaults to 64.

  • height – The total height of the display(s) in Pixels. Defaults to 32.

  • Serpentine (bool) – Used when panels are arranged in a serpentine pattern rather than a Z-pattern. Defaults to True.

  • tiles_rows (int) – Used to indicate the number of rows the panels are arranged in. Defaults to 1.

adafruit_matrixportal.graphics

Helper library for the MatrixPortal M4 or Adafruit RGB Matrix Shield + Metro M4 Airlift Lite.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_matrixportal.graphics.Graphics(**kwargs)

Graphics Helper Class for the MatrixPortal Library

Parameters
  • default_bg – The path to your default background image file or a hex color. Defaults to 0x000000.

  • width (int) – The total width of the display(s) in Pixels. Defaults to 64.

  • height (int) – The total height of the display(s) in Pixels. Defaults to 32.

  • bit_depth (int) – The number of bits per color channel. Defaults to 2.

  • alt_addr_pins (list) – An alternate set of address pins to use. Defaults to None

  • color_order (string) – A string containing the letter “R”, “G”, and “B” in the order you want. Defaults to “RGB”

  • Serpentine (bool) – Used when panels are arranged in a serpentine pattern rather than a Z-pattern. Defaults to True.

  • tiles_rows (int) – Used to indicate the number of rows the panels are arranged in. Defaults to 1.

  • debug – Turn on debug print outs. Defaults to False.

adafruit_matrixportal.matrixportal

Helper library for the MatrixPortal M4 or Adafruit RGB Matrix Shield + Metro M4 Airlift Lite.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_matrixportal.matrixportal.MatrixPortal(*, url=None, headers=None, json_path=None, regexp_path=None, default_bg=0, status_neopixel=None, json_transform=None, esp=None, external_spi=None, bit_depth=2, alt_addr_pins=None, color_order='RGB', debug=False, width=64, height=32, serpentine=True, tile_rows=1, rotation=0)

Class representing the Adafruit RGB Matrix Portal.

Parameters
  • url – The URL of your data source. Defaults to None.

  • headers – The headers for authentication, typically used by Azure API’s.

  • json_path – The list of json traversal to get data out of. Can be list of lists for multiple data points. Defaults to None to not use json.

  • regexp_path – The list of regexp strings to get data out (use a single regexp group). Can be list of regexps for multiple data points. Defaults to None to not use regexp.

  • default_bg – The path to your default background image file or a hex color. Defaults to 0x000000.

  • status_neopixel – The pin for the status NeoPixel. Use board.NEOPIXEL for the on-board NeoPixel. Defaults to None, not the status LED

  • json_transform – A function or a list of functions to call with the parsed JSON. Changes and additions are permitted for the dict object.

  • esp – A passed ESP32 object, Can be used in cases where the ESP32 chip needs to be used before calling the pyportal class. Defaults to None.

  • external_spi (busio.SPI) – A previously declared spi object. Defaults to None.

  • bit_depth (int) – The number of bits per color channel. Defaults to 2.

  • alt_addr_pins (list) – An alternate set of address pins to use. Defaults to None

  • color_order (string) – A string containing the letter “R”, “G”, and “B” in the order you want. Defaults to “RGB”

  • debug – Turn on debug print outs. Defaults to False.

  • width (int) – The total width of the display(s) in Pixels. Defaults to 64.

  • height (int) – The total height of the display(s) in Pixels. Defaults to 32.

  • Serpentine (bool) – Used when panels are arranged in a serpentine pattern rather than a Z-pattern. Defaults to True.

  • tiles_rows (int) – Used to indicate the number of rows the panels are arranged in. Defaults to 1.

add_text(text_position=None, text_font=<fontio.BuiltinFont object>, text_color=8421504, text_wrap=False, text_maxlen=0, text_transform=None, text_scale=1, scrolling=False, line_spacing=1.25, text_anchor_point=(0, 0.5), is_data=True)

Add text labels with settings

Parameters
  • text_font (str) – The path to your font file for your data text display.

  • text_position – The position of your extracted text on the display in an (x, y) tuple. Can be a list of tuples for when there’s a list of json_paths, for example.

  • text_color – The color of the text, in 0xRRGGBB format. Can be a list of colors for when there’s multiple texts. Defaults to None.

  • text_wrap – When non-zero, the maximum number of characters on each line before text is wrapped. (for long text data chunks). Defaults to 0, no wrapping.

  • text_maxlen – The max length of the text. If non-zero, it will be truncated to this length. Defaults to 0.

  • text_transform – A function that will be called on the text before display

  • text_scale (int) – The factor to scale the default size of the text by

  • scrolling (bool) – If true, text is placed offscreen and the scroll() function is used to scroll text on a pixel-by-pixel basis. Multiple text labels with the scrolling set to True will be cycled through.

  • text_anchor_point ((float, float)) – Values between 0 and 1 to indicate where the text position is relative to the label

  • is_data (bool) – If True, fetch will attempt to update the label

scroll()

Scroll any text that needs scrolling by a single frame. We also we want to queue up multiple lines one after another. To get simultaneous lines, we can simply use a line break.

scroll_text(frame_delay=0.02)

Scroll the entire text all the way across. We also we want to queue up multiple lines one after another. To get simultaneous lines, we can simply use a line break.

set_background(file_or_color, position=None)

The background image to a bitmap file.

Parameters

file_or_color – The filename of the chosen background image, or a hex color.

adafruit_matrixportal.network

Helper library for the MatrixPortal M4 or Adafruit RGB Matrix Shield + Metro M4 Airlift Lite.

  • Author(s): Melissa LeBlanc-Williams

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_matrixportal.network.Network(**kwargs)

Class representing the Adafruit RGB Matrix Portal.

Parameters
  • status_neopixel – The pin for the status NeoPixel. Use board.NEOPIXEL for the on-board NeoPixel. Defaults to None, not the status LED

  • esp – A passed ESP32 object, Can be used in cases where the ESP32 chip needs to be used before calling the pyportal class. Defaults to None.

  • external_spi (busio.SPI) – A previously declared spi object. Defaults to None.

  • extract_values (bool) – If true, single-length fetched values are automatically extracted from lists and tuples. Defaults to True.

  • debug – Turn on debug print outs. Defaults to False.

property ip_address

Return the IP Address nicely formatted