Simple test

Ensure your device works with this simple test.

examples/il0373_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Simple test script for 2.13" 212x104 tri-color featherwing.
 5
 6Supported products:
 7  * Adafruit 2.13" Tri-Color FeatherWing
 8    * https://www.adafruit.com/product/4128
 9"""
10
11import time
12
13import board
14import displayio
15import fourwire
16
17import adafruit_il0373
18
19displayio.release_displays()
20
21epd_cs = board.D9
22epd_dc = board.D10
23
24display_bus = fourwire.FourWire(board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000)
25time.sleep(1)
26
27display = adafruit_il0373.IL0373(
28    display_bus, width=212, height=104, rotation=90, highlight_color=0xFF0000
29)
30
31g = displayio.Group()
32
33pic = displayio.OnDiskBitmap("/display-ruler.bmp")
34t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
35g.append(t)
36
37display.root_group = g
38
39display.refresh()
40
41print("refreshed")
42time.sleep(120)

Device Specific Examples

examples/il0373_1.54_color.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Simple test script for 1.54" 152x152 tri-color display.
 5
 6Supported products:
 7  * Adafruit 1.54" Tri-Color Display Breakout
 8    * https://www.adafruit.com/product/3625
 9"""
10
11import time
12
13import board
14import displayio
15import fourwire
16
17import adafruit_il0373
18
19displayio.release_displays()
20
21# This pinout works on a Feather 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.D5
26epd_busy = board.D6
27
28display_bus = fourwire.FourWire(
29    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
30)
31time.sleep(1)
32
33display = adafruit_il0373.IL0373(
34    display_bus,
35    width=152,
36    height=152,
37    busy_pin=epd_busy,
38    highlight_color=0xFF0000,
39    rotation=180,
40)
41
42g = displayio.Group()
43
44
45pic = displayio.OnDiskBitmap("/display-ruler.bmp")
46t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
47g.append(t)
48
49display.root_group = g
50
51display.refresh()
52
53print("refreshed")
54
55time.sleep(120)
examples/il0373_2.9_color.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Simple test script for Adafruit 2.9" 296x128 tri-color display
 5Supported products:
 6  * Adafruit 2.9" Tri-Color Display Breakout
 7  * https://www.adafruit.com/product/1028
 8"""
 9
10import time
11
12import board
13import displayio
14import fourwire
15
16import adafruit_il0373
17
18# Used to ensure the display is free in CircuitPython
19displayio.release_displays()
20
21# Define the pins needed for display use
22# This pinout is for a Feather M4 and may be different for other boards
23spi = board.SPI()  # Uses SCK and MOSI
24epd_cs = board.D9
25epd_dc = board.D10
26epd_reset = board.D5
27epd_busy = board.D6
28
29# Create the displayio connection to the display pins
30display_bus = fourwire.FourWire(
31    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
32)
33time.sleep(1)  # Wait a bit
34
35# Create the display object - the third color is red (0xff0000)
36display = adafruit_il0373.IL0373(
37    display_bus,
38    width=296,
39    height=128,
40    rotation=270,
41    busy_pin=epd_busy,
42    highlight_color=0xFF0000,
43)
44
45# Create a display group for our screen objects
46g = displayio.Group()
47
48# Display a ruler graphic from the root directory of the CIRCUITPY drive
49pic = displayio.OnDiskBitmap("/display-ruler.bmp")
50t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
51g.append(t)
52
53display.root_group = g
54
55display.refresh()
56
57print("refreshed")
58time.sleep(180)
examples/il0373_2.9_grayscale.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Simple test script for 2.9" 296x128 grayscale display.
 5
 6Supported products:
 7  * Adafruit 2.9" Grayscale
 8    * https://www.adafruit.com/product/4777
 9"""
10
11import time
12
13import board
14import busio
15import displayio
16import fourwire
17
18import adafruit_il0373
19
20displayio.release_displays()
21
22# This pinout works on a Feather M4 and may need to be altered for other boards.
23spi = busio.SPI(board.SCK, board.MOSI)  # Uses SCK and MOSI
24epd_cs = board.D9
25epd_dc = board.D10
26
27display_bus = fourwire.FourWire(spi, command=epd_dc, chip_select=epd_cs, baudrate=1000000)
28time.sleep(1)
29
30display = adafruit_il0373.IL0373(
31    display_bus,
32    width=296,
33    height=128,
34    rotation=270,
35    black_bits_inverted=False,
36    color_bits_inverted=False,
37    grayscale=True,
38    refresh_time=1,
39)
40
41g = displayio.Group()
42
43pic = displayio.OnDiskBitmap("/display-ruler.bmp")
44t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
45g.append(t)
46
47display.root_group = g
48
49display.refresh()
50
51print("refreshed")
52time.sleep(120)
examples/il0373_2.13_color.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Simple test script for Adafruit 2.13" 212x104 tri-color display
 5Supported products:
 6  * Adafruit 2.13" Tri-Color Display Breakout
 7  * https://www.adafruit.com/product/4086 (breakout) or
 8  * https://www.adafruit.com/product/4128 (FeatherWing)
 9"""
10
11import time
12
13import board
14import displayio
15import fourwire
16
17import adafruit_il0373
18
19# Used to ensure the display is free in CircuitPython
20displayio.release_displays()
21
22# Define the pins needed for display use
23# This pinout is for a Feather M4 and may be different for other boards
24spi = board.SPI()  # Uses SCK and MOSI
25epd_cs = board.D9
26epd_dc = board.D10
27epd_reset = board.D5
28epd_busy = board.D6
29
30# Create the displayio connection to the display pins
31display_bus = fourwire.FourWire(
32    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
33)
34time.sleep(1)  # Wait a bit
35
36# Create the display object - the third color is red (0xff0000)
37display = adafruit_il0373.IL0373(
38    display_bus,
39    width=212,
40    height=104,
41    rotation=90,
42    busy_pin=epd_busy,
43    highlight_color=0xFF0000,
44)
45
46# Create a display group for our screen objects
47g = displayio.Group()
48
49# Display a ruler graphic from the root directory of the CIRCUITPY drive
50pic = displayio.OnDiskBitmap("/display-ruler.bmp")
51t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
52g.append(t)
53
54display.root_group = g
55
56display.refresh()
57
58print("refreshed")
59time.sleep(180)
examples/il0373_flexible_2.9_monochrome.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Simple test script for 2.9" 296x128 monochrome display.
 5
 6Supported products:
 7  * Adafruit Flexible 2.9" Monochrome
 8    * https://www.adafruit.com/product/4262
 9"""
10
11import time
12
13import board
14import displayio
15import fourwire
16
17import adafruit_il0373
18
19displayio.release_displays()
20
21# This pinout works on a Feather 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.D5
26epd_busy = board.D6
27
28display_bus = fourwire.FourWire(
29    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
30)
31time.sleep(1)
32
33display = adafruit_il0373.IL0373(
34    display_bus, width=296, height=128, rotation=90, busy_pin=epd_busy, swap_rams=True
35)
36
37g = displayio.Group()
38
39pic = displayio.OnDiskBitmap("/display-ruler.bmp")
40t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
41g.append(t)
42
43display.root_group = g
44
45display.refresh()
46
47print("refreshed")
48time.sleep(120)
examples/il0373_2.13_monochrome.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Simple test script for 2.13" 212x104 monochrome display.
 5
 6Supported products:
 7  * Adafruit Flexible 2.13" Monochrome
 8    * https://www.adafruit.com/product/4243
 9"""
10
11import time
12
13import board
14import displayio
15import fourwire
16
17import adafruit_il0373
18
19displayio.release_displays()
20
21# This pinout works on a Feather 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.D5
26epd_busy = board.D6
27
28display_bus = fourwire.FourWire(
29    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
30)
31time.sleep(1)
32
33display = adafruit_il0373.IL0373(
34    display_bus, width=212, height=104, rotation=90, busy_pin=epd_busy, swap_rams=True
35)
36
37g = displayio.Group()
38
39pic = displayio.OnDiskBitmap("/display-ruler.bmp")
40t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
41g.append(t)
42
43display.root_group = g
44
45display.refresh()
46
47print("refreshed")
48time.sleep(180)