From 5dbbb1907948c637f9e960e3d79561dc7eed3d5a Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 22 Feb 2021 17:36:49 -0800 Subject: [PATCH] Added EInk HD Gizmo --- adafruit_gizmo/eink_gizmo.py | 35 +++++++++++++++++-- docs/conf.py | 10 +++++- docs/examples.rst | 8 +++++ examples/gizmo_eink_simpletest.py | 2 ++ ...termometer.py => gizmo_tft_thermometer.py} | 0 5 files changed, 52 insertions(+), 3 deletions(-) mode change 100644 => 100755 adafruit_gizmo/eink_gizmo.py rename examples/{gizmo_tft_termometer.py => gizmo_tft_thermometer.py} (100%) diff --git a/adafruit_gizmo/eink_gizmo.py b/adafruit_gizmo/eink_gizmo.py old mode 100644 new mode 100755 index 259c620..ed850cf --- a/adafruit_gizmo/eink_gizmo.py +++ b/adafruit_gizmo/eink_gizmo.py @@ -3,7 +3,7 @@ # SPDX-License-Identifier: MIT """ -`adafruit_gizmo.tft_gizmo` +`adafruit_gizmo.eink_gizmo` ================================================================================ Helper for the `Tri-Color E-Ink Gizmo `_. @@ -19,10 +19,11 @@ import board import displayio from adafruit_il0373 import IL0373 +from adafruit_ssd1681 import SSD1681 # pylint: disable=invalid-name, too-few-public-methods class EInk_Gizmo(IL0373): - """Class representing a EInk Gizmo.""" + """Class representing a 152x152 Tri-Color EInk Gizmo.""" def __init__(self, *, spi=None, cs=None, dc=None, reset=None, busy=None): displayio.release_displays() @@ -48,3 +49,33 @@ def __init__(self, *, spi=None, cs=None, dc=None, reset=None, busy=None): rotation=180, highlight_color=0xFF0000, ) + + +# pylint: disable=invalid-name, too-few-public-methods +class EInk_HD_Gizmo(SSD1681): + """Class representing a 200x200 Tri-Color EInk HD Gizmo.""" + + def __init__(self, *, spi=None, cs=None, dc=None, reset=None, busy=None): + displayio.release_displays() + if spi is None: + import busio # pylint: disable=import-outside-toplevel + + spi = busio.SPI(board.SCL, MOSI=board.SDA) + if cs is None: + cs = board.RX + if dc is None: + dc = board.TX + if reset is None: + reset = board.A3 + self._display_bus = displayio.FourWire( + spi, command=dc, chip_select=cs, reset=reset, baudrate=1000000 + ) + sleep(1) + super().__init__( + self._display_bus, + width=200, + height=200, + busy_pin=busy, + rotation=180, + highlight_color=0xFF0000, + ) diff --git a/docs/conf.py b/docs/conf.py index 9099223..de7a0d3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,15 @@ # Uncomment the below if you use native CircuitPython modules such as # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. -autodoc_mock_imports = ["adafruit_st7789", "digitalio", "busio", "displayio", "board"] +autodoc_mock_imports = [ + "adafruit_st7789", + "digitalio", + "busio", + "displayio", + "board", + "adafruit_il0373", + "adafruit_ssd1608", +] intersphinx_mapping = { diff --git a/docs/examples.rst b/docs/examples.rst index d93a4dd..7bc4eb0 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -13,3 +13,11 @@ Other examples .. literalinclude:: ../examples/gizmo_tft_demo.py :caption: examples/gizmo_tft_demo.py :linenos: + +.. literalinclude:: ../examples/gizmo_tft_thermometer.py + :caption: examples/gizmo_tft_thermometer.py + :linenos: + +.. literalinclude:: ../examples/gizmo_eink_simpletest.py + :caption: examples/gizmo_eink_simpletest.py + :linenos: diff --git a/examples/gizmo_eink_simpletest.py b/examples/gizmo_eink_simpletest.py index db6a07a..2800d47 100644 --- a/examples/gizmo_eink_simpletest.py +++ b/examples/gizmo_eink_simpletest.py @@ -6,6 +6,8 @@ from adafruit_gizmo import eink_gizmo display = eink_gizmo.EInk_Gizmo() +# Use the below line instead for the 200x200 E-Ink Gizmo +# display = eink_gizmo.EInk_HD_Gizmo() # Create a display group for our screen objects display_group = displayio.Group() diff --git a/examples/gizmo_tft_termometer.py b/examples/gizmo_tft_thermometer.py similarity index 100% rename from examples/gizmo_tft_termometer.py rename to examples/gizmo_tft_thermometer.py