Simple test

Ensure your device works with this simple test.

examples/jd79667_simpletest.py
 1# SPDX-FileCopyrightText: 2025 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 3.52" 340x180 Quad-Color eInk."""
 7
 8import time
 9
10import board
11import busio
12import displayio
13from fourwire import FourWire
14
15import adafruit_jd79667
16
17displayio.release_displays()
18
19spi = busio.SPI(board.EPD_SCK, board.EPD_MOSI)  # Uses SCK and MOSI
20epd_cs = board.EPD_CS
21epd_dc = board.EPD_DC
22epd_reset = board.EPD_RESET
23epd_busy = board.EPD_BUSY
24
25display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
26time.sleep(1)
27
28display = adafruit_jd79667.JD79667(
29    display_bus,
30    width=384,
31    height=184,
32    busy_pin=epd_busy,
33    rotation=270,
34    colstart=0,
35    highlight_color=0xFFFF00,
36    highlight_color2=0xFF0000,
37)
38
39g = displayio.Group()
40
41pic = displayio.OnDiskBitmap("/display-ruler-640x360.bmp")
42t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
43g.append(t)
44
45display.root_group = g
46
47display.refresh()
48
49print("refreshed")
50
51time.sleep(display.time_to_refresh + 5)
52# Always refresh a little longer. It's not a problem to refresh
53# a few seconds more, but it's terrible to refresh too early
54# (the display will throw an exception when if the refresh
55# is too soon)
56print("waited correct time")
57
58
59# Keep the display the same
60while True:
61    time.sleep(10)