Simple test

Ensure your device works with this simple test.

examples/spd1656_simpletest.py
 1# SPDX-FileCopyrightText: Copyright (c) 2023 Scott Shawcroft 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 5.6" 600x448 7-color ACeP display.
 7  """
 8# pylint: disable=no-member
 9
10import time
11import board
12import displayio
13import fourwire
14import adafruit_spd1656
15
16
17displayio.release_displays()
18
19# This pinout works on a Feather RP2040 and may need to be altered for other boards.
20spi = board.SPI()  # Uses SCK and MOSI
21epd_cs = board.D9
22epd_dc = board.D10
23epd_reset = board.D11
24epd_busy = board.D12
25
26display_bus = fourwire.FourWire(
27    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
28)
29
30display = adafruit_spd1656.SPD1656(
31    display_bus, width=600, height=448, busy_pin=epd_busy
32)
33
34g = displayio.Group()
35
36fn = "/display-ruler-720p.bmp"
37
38with open(fn, "rb") as f:
39    pic = displayio.OnDiskBitmap(f)
40    t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
41    g.append(t)
42
43    display.root_group = g
44
45    display.refresh()
46
47    time.sleep(120)

Stripes test

Show stripes with each of the colors that can be displayed

examples/spd1656_color_stripes.py
 1# SPDX-FileCopyrightText: Copyright (c) 2023 Tim Cocks for Adafruit Industries
 2#
 3# SPDX-License-Identifier: Unlicense
 4
 5"""Stripes test script for 5.6" 600x448 7-color ACeP display.
 6Fill the screen with striped rows, one for each possible color.
 7"""
 8# pylint: disable=no-member
 9
10import board
11import displayio
12import bitmaptools
13import fourwire
14import adafruit_spd1656
15
16
17displayio.release_displays()
18
19# This pinout works on a Feather RP2040 and may need to be altered for other boards.
20spi = board.SPI()  # Uses SCK and MOSI
21epd_cs = board.D9
22epd_dc = board.D10
23epd_reset = board.D11
24epd_busy = board.D12
25
26display_bus = fourwire.FourWire(
27    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
28)
29
30display = adafruit_spd1656.SPD1656(
31    display_bus, width=600, height=448, busy_pin=epd_busy
32)
33
34g = displayio.Group()
35
36bmp = displayio.Bitmap(display.width, display.height, 7)
37p = displayio.Palette(7)
38p[0] = 0xFFFFFF
39p[1] = 0x000000
40p[2] = 0x0000FF
41p[3] = 0x00FF00
42p[4] = 0xFF0000
43p[5] = 0xFFFF00
44p[6] = 0xFFA500
45
46bmp.fill(0)
47
48for i in range(7):
49    bitmaptools.fill_region(
50        bmp,
51        0,
52        i * (display.height // 7),
53        display.width,
54        i * (display.height // 7) + (display.height // 7),
55        i,
56    )
57
58tg = displayio.TileGrid(bitmap=bmp, pixel_shader=p)
59g.append(tg)
60
61display.root_group = g
62
63display.refresh()
64
65while True:
66    pass

Colors and Text Example

Display a filled colored rectangle with a different border color and test layered on top in the center.

examples/spd1656_colors_and_text.py
 1# SPDX-FileCopyrightText: Copyright (c) 2023 Tim Cocks for Adafruit Industries
 2#
 3# SPDX-License-Identifier: Unlicense
 4
 5"""Colors and Text script for 5.6" 600x448 7-color ACeP display.
 6Draw a border and screen filled with color and layer text on top
 7of it.
 8"""
 9# pylint: disable=no-member
10
11import board
12import displayio
13import terminalio
14import bitmaptools
15from adafruit_display_text.bitmap_label import Label
16import fourwire
17import adafruit_spd1656
18
19
20displayio.release_displays()
21
22# This pinout works on a Feather RP2040 and may need to be altered for other boards.
23spi = board.SPI()  # Uses SCK and MOSI
24epd_cs = board.D9
25epd_dc = board.D10
26epd_reset = board.D11
27epd_busy = board.D12
28
29display_bus = fourwire.FourWire(
30    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
31)
32
33display = adafruit_spd1656.SPD1656(
34    display_bus, width=600, height=448, busy_pin=epd_busy
35)
36
37g = displayio.Group()
38
39bmp = displayio.Bitmap(display.width, display.height, 7)
40p = displayio.Palette(7)
41p[0] = 0xFFFFFF
42p[1] = 0x000000
43p[2] = 0x0000FF
44p[3] = 0x00FF00
45p[4] = 0xFF0000
46p[5] = 0xFFFF00
47p[6] = 0xFFA500
48
49bmp.fill(2)
50
51bitmaptools.fill_region(bmp, 40, 40, display.width - 40, display.height - 40, 3)
52tg = displayio.TileGrid(bitmap=bmp, pixel_shader=p)
53g.append(tg)
54
55lbl = Label(terminalio.FONT, text="Hello World", color=0xFFFFFF, scale=3)
56lbl.anchor_point = (0.5, 0.5)
57lbl.anchored_position = (display.width // 2, display.height // 2)
58g.append(lbl)
59
60display.root_group = g
61display.refresh()
62
63while True:
64    pass