Simple test

Ensure your device works with this simple test.

examples/jd79661_simpletest.py
 1# SPDX-FileCopyrightText: 2025 Scott Shawcroft, written for Adafruit Industries
 2#
 3# SPDX-License-Identifier: Unlicense
 4
 5"""Simple test script for 2.13" Quad Color Display"""
 6
 7import time
 8
 9import board
10import displayio
11from fourwire import FourWire
12
13import adafruit_jd79661
14
15displayio.release_displays()
16
17spi = board.SPI()
18epd_cs = board.D9
19epd_dc = board.D10
20epd_reset = board.D6
21epd_busy = board.D5
22
23display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
24time.sleep(1)
25
26display = adafruit_jd79661.JD79661(
27    display_bus,
28    width=250,
29    height=122,
30    busy_pin=epd_busy,
31    rotation=270,
32    colstart=0,
33    highlight_color=0x00FF00,
34    highlight_color2=0xFF0000,
35)
36
37g = displayio.Group()
38
39pic = displayio.OnDiskBitmap("/display-ruler-640x360.bmp")
40t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
41g.append(t)
42
43display.root_group = g
44
45display.refresh()
46
47print("refreshed")
48
49time.sleep(display.time_to_refresh + 5)
50# Always refresh a little longer. It's not a problem to refresh
51# a few seconds more, but it's terrible to refresh too early
52# (the display will throw an exception when if the refresh
53# is too soon)
54print("waited correct time")
55
56
57# Keep the display the same
58while True:
59    time.sleep(10)