Skip to content

Commit f4011e9

Browse files
authored
Merge pull request #4 from makermelissa/master
Added example for 2.9-inch eInk
2 parents 7436b4d + 1e37ce6 commit f4011e9

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

examples/il0373_2.9_color.py

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""Simple test script for Adafruit 2.9" 296x128 tri-color display
2+
Supported products:
3+
* Adafruit 2.9" Tri-Color Display Breakout
4+
* https://www.adafruit.com/product/1028
5+
"""
6+
7+
import time
8+
import board
9+
import displayio
10+
import adafruit_il0373
11+
12+
# Used to ensure the display is free in CircuitPython
13+
displayio.release_displays()
14+
15+
# Define the pins needed for display use
16+
# This pinout is for a Feather M4 and may be different for other boards
17+
spi = board.SPI() # Uses SCK and MOSI
18+
epd_cs = board.D9
19+
epd_dc = board.D10
20+
epd_reset = board.D5
21+
epd_busy = board.D6
22+
23+
# Create the displayio connection to the display pins
24+
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,
25+
reset=epd_reset, baudrate=1000000)
26+
time.sleep(1) # Wait a bit
27+
28+
# Create the display object - the third color is red (0xff0000)
29+
display = adafruit_il0373.IL0373(display_bus, width=296, height=128,
30+
rotation=270, busy_pin=epd_busy,
31+
highlight_color=0xff0000)
32+
33+
# Create a display group for our screen objects
34+
g = displayio.Group()
35+
36+
# Display a ruler graphic from the root directory of the CIRCUITPY drive
37+
f = open("/display-ruler.bmp", "rb")
38+
39+
pic = displayio.OnDiskBitmap(f)
40+
# Create a Tilegrid with the bitmap and put in the displayio group
41+
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
42+
g.append(t)
43+
44+
# Place the display group on the screen
45+
display.show(g)
46+
47+
# Refresh the display to have it actually show the image
48+
# NOTE: Do not refresh eInk displays sooner than 180 seconds
49+
display.refresh()
50+
print("refreshed")
51+
52+
time.sleep(180)

0 commit comments

Comments
 (0)