-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepd_test.py
56 lines (42 loc) · 1.35 KB
/
epd_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import time
import board
import displayio
import adafruit_ssd1680
from fourwire import FourWire
displayio.release_displays()
# This pinout works on a Metro M4 and may need to be altered for other boards.
spi = board.EPD_SPI() # Uses SCK and MOSI
epd_cs = board.EPD_CS
epd_dc = board.EPD_DC
epd_reset = board.EPD_RST # Set to None for FeatherWing
epd_busy = board.EPD.BUSY # Set to None for FeatherWing
display_bus = FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
time.sleep(1)
# For issues with display not updating top/bottom rows correctly set colstart to 8
display = adafruit_ssd1680.SSD1680(
display_bus,
width=250,
height=122,
busy_pin=epd_busy,
highlight_color=0xFF0000,
rotation=270,
)
g = displayio.Group()
with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
display.root_group = g
display.refresh()
print("refreshed")
time.sleep(display.time_to_refresh + 5)
# Always refresh a little longer. It's not a problem to refresh
# a few seconds more, but it's terrible to refresh too early
# (the display will throw an exception when if the refresh
# is too soon)
print("waited correct time")
# Keep the display the same
while True:
time.sleep(10)