Skip to content

Added eInk Gizmo #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions adafruit_gizmo/eink_gizmo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# The MIT License (MIT)
#
# Copyright (c) 2019 Melissa LeBlanc-Williams for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""
`adafruit_gizmo.tft_gizmo`
================================================================================

Helper for the `Tri-Color E-Ink Gizmo <https://www.adafruit.com/product/4428>`_.


* Author(s): Melissa LeBlanc-Williams
"""

__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Gizmo.git"

from time import sleep
import board
import displayio
from adafruit_il0373 import IL0373

# pylint: disable=invalid-name, too-few-public-methods
class EInk_Gizmo(IL0373):
"""Class representing a EInk Gizmo."""

def __init__(self, *, spi=None, cs=None, dc=None, reset=None, busy=None):
displayio.release_displays()
if spi is None:
import busio
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=152, height=152,
busy_pin=busy, rotation=180,
highlight_color=0xff0000)
26 changes: 26 additions & 0 deletions examples/gizmo_eink_simpletest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import time
import displayio
from adafruit_gizmo import eink_gizmo

display = eink_gizmo.EInk_Gizmo()

# Create a display group for our screen objects
display_group = displayio.Group()

# Display a ruler graphic from the root directory of the CIRCUITPY drive
file = open("/display-ruler.bmp", "rb")

picture = displayio.OnDiskBitmap(file)
# Create a Tilegrid with the bitmap and put in the displayio group
sprite = displayio.TileGrid(picture, pixel_shader=displayio.ColorConverter())
display_group.append(sprite)

# Place the display group on the screen
display.show(display_group)

# Refresh the display to have it actually show the image
# NOTE: Do not refresh eInk displays sooner than 180 seconds
display.refresh()
print("refreshed")

time.sleep(180)