|
| 1 | +# The MIT License (MIT) |
| 2 | +# |
| 3 | +# Copyright (c) 2019 Melissa LeBlanc-Williams for Adafruit Industries |
| 4 | +# |
| 5 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +# of this software and associated documentation files (the "Software"), to deal |
| 7 | +# in the Software without restriction, including without limitation the rights |
| 8 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | +# copies of the Software, and to permit persons to whom the Software is |
| 10 | +# furnished to do so, subject to the following conditions: |
| 11 | +# |
| 12 | +# The above copyright notice and this permission notice shall be included in |
| 13 | +# all copies or substantial portions of the Software. |
| 14 | +# |
| 15 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 21 | +# THE SOFTWARE. |
| 22 | +""" |
| 23 | +`adafruit_gizmo.tft_gizmo` |
| 24 | +================================================================================ |
| 25 | +
|
| 26 | +Helper for the `Tri-Color E-Ink Gizmo <https://www.adafruit.com/product/4428>`_. |
| 27 | +
|
| 28 | +
|
| 29 | +* Author(s): Melissa LeBlanc-Williams |
| 30 | +""" |
| 31 | + |
| 32 | +__version__ = "0.0.0-auto.0" |
| 33 | +__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Gizmo.git" |
| 34 | + |
| 35 | +from time import sleep |
| 36 | +import board |
| 37 | +import displayio |
| 38 | +from adafruit_il0373 import IL0373 |
| 39 | + |
| 40 | +# pylint: disable=invalid-name, too-few-public-methods |
| 41 | +class EInk_Gizmo(IL0373): |
| 42 | + """Class representing a EInk Gizmo.""" |
| 43 | + |
| 44 | + def __init__(self, *, spi=None, cs=None, dc=None, reset=None, busy=None): |
| 45 | + displayio.release_displays() |
| 46 | + if spi is None: |
| 47 | + import busio |
| 48 | + spi = busio.SPI(board.SCL, MOSI=board.SDA) |
| 49 | + if cs is None: |
| 50 | + cs = board.RX |
| 51 | + if dc is None: |
| 52 | + dc = board.TX |
| 53 | + if reset is None: |
| 54 | + reset = board.A3 |
| 55 | + self._display_bus = displayio.FourWire(spi, |
| 56 | + command=dc, |
| 57 | + chip_select=cs, |
| 58 | + reset=reset, |
| 59 | + baudrate=1000000) |
| 60 | + sleep(1) |
| 61 | + super().__init__(self._display_bus, width=152, height=152, |
| 62 | + busy_pin=busy, rotation=180, |
| 63 | + highlight_color=0xff0000) |
0 commit comments