diff --git a/adafruit_matrixportal/graphics.py b/adafruit_matrixportal/graphics.py index 491f050..ec9210b 100755 --- a/adafruit_matrixportal/graphics.py +++ b/adafruit_matrixportal/graphics.py @@ -38,20 +38,30 @@ class Graphics: :param default_bg: The path to your default background image file or a hex color. Defaults to 0x000000. - :param width: The width of the display in Pixels. Defaults to 64. - :param height: The height of the display in Pixels. Defaults to 32. + :param int width: The width of the display in Pixels. Defaults to 64. + :param int height: The height of the display in Pixels. Defaults to 32. :param int bit_depth: The number of bits per color channel. Defaults to 2. + :param list alt_addr_pins: An alternate set of address pins to use. Defaults to None :param debug: Turn on debug print outs. Defaults to False. """ # pylint: disable=too-many-instance-attributes, too-many-locals, too-many-branches, too-many-statements def __init__( - self, *, default_bg=0x000000, width=64, height=32, bit_depth=2, debug=False + self, + *, + default_bg=0x000000, + width=64, + height=32, + bit_depth=2, + alt_addr_pins=None, + debug=False ): self._debug = debug - matrix = Matrix(bit_depth=bit_depth, width=width, height=height) + matrix = Matrix( + bit_depth=bit_depth, width=width, height=height, alt_addr_pins=alt_addr_pins + ) self.display = matrix.display if self._debug: diff --git a/adafruit_matrixportal/matrix.py b/adafruit_matrixportal/matrix.py index ddcaab9..3faf738 100755 --- a/adafruit_matrixportal/matrix.py +++ b/adafruit_matrixportal/matrix.py @@ -39,16 +39,20 @@ class Matrix: """Class representing the Adafruit RGB Matrix. This is used to automatically initialize the display. - :param width: The width of the display in Pixels. Defaults to 64. - :param height: The height of the display in Pixels. Defaults to 32. - :param bit_depth: The number of bits per color channel. Defaults to 2. + :param int width: The width of the display in Pixels. Defaults to 64. + :param int height: The height of the display in Pixels. Defaults to 32. + :param int bit_depth: The number of bits per color channel. Defaults to 2. + :param list alt_addr_pins: An alternate set of address pins to use. Defaults to None """ # pylint: disable=too-few-public-methods - def __init__( - self, *, width=64, height=32, bit_depth=2, - ): + def __init__(self, *, width=64, height=32, bit_depth=2, alt_addr_pins=None): + + if alt_addr_pins is not None: + addr_pins = alt_addr_pins + else: + addr_pins = [board.A0, board.A1, board.A2, board.A3] try: displayio.release_displays() @@ -57,7 +61,7 @@ def __init__( height=height, bit_depth=bit_depth, rgb_pins=[board.D2, board.D3, board.D4, board.D5, board.D6, board.D7], - addr_pins=[board.A0, board.A1, board.A2, board.A3], + addr_pins=addr_pins, clock_pin=board.A4, latch_pin=board.D10, output_enable_pin=board.D9, diff --git a/adafruit_matrixportal/matrixportal.py b/adafruit_matrixportal/matrixportal.py index b91c57b..d287c8a 100755 --- a/adafruit_matrixportal/matrixportal.py +++ b/adafruit_matrixportal/matrixportal.py @@ -57,6 +57,7 @@ class MatrixPortal: before calling the pyportal class. Defaults to ``None``. :param busio.SPI external_spi: A previously declared spi object. Defaults to ``None``. :param int bit_depth: The number of bits per color channel. Defaults to 2. + :param list alt_addr_pins: An alternate set of address pins to use. Defaults to None :param debug: Turn on debug print outs. Defaults to False. """ @@ -75,12 +76,18 @@ def __init__( esp=None, external_spi=None, bit_depth=2, + alt_addr_pins=None, debug=False ): self._debug = debug self.graphics = Graphics( - default_bg=default_bg, bit_depth=bit_depth, width=64, height=32, debug=debug + default_bg=default_bg, + bit_depth=bit_depth, + width=64, + height=32, + alt_addr_pins=alt_addr_pins, + debug=debug, ) self.display = self.graphics.display