Simple test
Ensure your device works with this simple test.
examples/ek79686_simpletest.py
1# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2# SPDX-FileCopyrightText: Copyright (c) 2023 Melissa LeBlanc-Williams for Adafruit Industries
3#
4# SPDX-License-Identifier: Unlicense
5"""
6Simple test script for 2.7" 264x176 Tri-Color display
7Supported products:
8* `Adafruit 2.7" Tri-Color eInk / ePaper Display
9with SRAM <https://www.adafruit.com/product/4098>`_
10
11This program only requires the adafruit_ek79686 library in /lib
12for CircuitPython 5.0 and above which has displayio support.
13"""
14
15import time
16
17import board
18import displayio
19from fourwire import FourWire
20
21import adafruit_ek79686
22
23# Used to ensure the display is free in CircuitPython
24displayio.release_displays()
25
26# Define the pins needed for display use on the Metro
27spi = board.SPI()
28epd_cs = board.D10
29epd_dc = board.D9
30epd_reset = board.D5
31epd_busy = board.D6
32
33# Create the displayio connection to the display pins
34display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
35time.sleep(1) # Wait a bit
36
37# Create the display object - the third color is red (0xff0000)
38display = adafruit_ek79686.EK79686(
39 display_bus,
40 width=264,
41 height=176,
42 busy_pin=epd_busy,
43 highlight_color=0xFF0000,
44 rotation=90,
45)
46
47# Create a display group for our screen objects
48g = displayio.Group()
49
50
51# Display a ruler graphic from the root directory of the CIRCUITPY drive
52pic = displayio.OnDiskBitmap("/display-ruler.bmp")
53# Create a Tilegrid with the bitmap and put in the displayio group
54t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
55g.append(t)
56
57# Place the display group on the screen (does not refresh)
58display.root_group = g
59
60# Show the image on the display
61display.refresh()
62
63print("refreshed")
64
65# Do Not refresh the screen more often than every 180 seconds
66# for eInk displays! Rapid refreshes will damage the panel.
67time.sleep(180)