diff --git a/adafruit_magtag/graphics.py b/adafruit_magtag/graphics.py index 51681bd..6d6d720 100755 --- a/adafruit_magtag/graphics.py +++ b/adafruit_magtag/graphics.py @@ -41,12 +41,15 @@ class Graphics: Defaults to 0x000000. :param bool auto_refresh: Automatically refresh the eInk after writing to displayio. Defaults to True. + :param rotation: Default rotation is landscape (270) but can be 0, 90, 180 for portrait/rotated :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=0xFFFFFF, auto_refresh=True, debug=False): + def __init__( + self, *, default_bg=0xFFFFFF, auto_refresh=True, rotation=270, debug=False + ): self._debug = debug if not hasattr(board, "DISPLAY"): @@ -65,7 +68,7 @@ def __init__(self, *, default_bg=0xFFFFFF, auto_refresh=True, debug=False): display_bus, width=296, height=128, - rotation=270, + rotation=rotation, black_bits_inverted=False, color_bits_inverted=False, grayscale=True, @@ -74,6 +77,7 @@ def __init__(self, *, default_bg=0xFFFFFF, auto_refresh=True, debug=False): ) else: self.display = board.DISPLAY + self.display.rotation = rotation self.auto_refresh = auto_refresh diff --git a/adafruit_magtag/magtag.py b/adafruit_magtag/magtag.py index 6b594c0..d0cd5cc 100755 --- a/adafruit_magtag/magtag.py +++ b/adafruit_magtag/magtag.py @@ -54,6 +54,8 @@ class MagTag: NeoPixel. Defaults to ``None``, not the status LED :param json_transform: A function or a list of functions to call with the parsed JSON. Changes and additions are permitted for the ``dict`` object. + :param rotation: Default rotation is landscape (270) but can be 0, 90, or 180 for + portrait/rotated :param debug: Turn on debug print outs. Defaults to False. """ @@ -69,6 +71,7 @@ def __init__( default_bg=0xFFFFFF, status_neopixel=None, json_transform=None, + rotation=270, debug=False, ): @@ -76,6 +79,7 @@ def __init__( self.graphics = Graphics( default_bg=default_bg, auto_refresh=False, + rotation=rotation, debug=debug, ) self.display = self.graphics.display