Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries
3#
4# SPDX-License-Identifier: Unlicense
5
6"""Simple test script for 2.13" 250x122 tri-color display.
7Supported products:
8 * Adafruit 2.13" Tri-Color eInk Display Breakout
9 * https://www.adafruit.com/product/4947
10 * Adafruit 2.13" Tri-Color eInk Display FeatherWing
11 * https://www.adafruit.com/product/4814
12"""
13
14import time
15import board
16import displayio
17import adafruit_ssd1680
18
19displayio.release_displays()
20
21# This pinout works on a Metro M4 and may need to be altered for other boards.
22spi = board.SPI() # Uses SCK and MOSI
23epd_cs = board.D9
24epd_dc = board.D10
25epd_reset = board.D8 # Set to None for FeatherWing
26epd_busy = board.D7 # Set to None for FeatherWing
27
28display_bus = displayio.FourWire(
29 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
30)
31time.sleep(1)
32
33display = adafruit_ssd1680.SSD1680(
34 display_bus,
35 width=250,
36 height=122,
37 busy_pin=epd_busy,
38 highlight_color=0xFF0000,
39 rotation=270,
40)
41
42g = displayio.Group()
43
44with open("/display-ruler.bmp", "rb") as f:
45 pic = displayio.OnDiskBitmap(f)
46 # CircuitPython 6 & 7 compatible
47 t = displayio.TileGrid(
48 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
49 )
50 # CircuitPython 7 compatible only
51 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
52 g.append(t)
53
54 display.show(g)
55
56 display.refresh()
57
58 print("refreshed")
59
60 time.sleep(120)