Skip to content

Commit 0921380

Browse files
committed
add line for 2.7" and also more complete framebuf test
1 parent 9010050 commit 0921380

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

examples/epd_simpletest.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,38 @@
33
import board
44
from adafruit_epd.epd import Adafruit_EPD
55
from adafruit_epd.il0373 import Adafruit_IL0373
6+
from adafruit_epd.il91874 import Adafruit_IL91874
67

78
# create the spi device and pins we will need
89
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
910
ecs = digitalio.DigitalInOut(board.D10)
1011
dc = digitalio.DigitalInOut(board.D9)
11-
srcs = digitalio.DigitalInOut(board.D8)
12-
rst = digitalio.DigitalInOut(board.D7)
13-
busy = digitalio.DigitalInOut(board.D6)
12+
srcs = digitalio.DigitalInOut(board.D7) # can be None to use internal memory
13+
rst = digitalio.DigitalInOut(board.D11) # can be None to not use this pin
14+
busy = digitalio.DigitalInOut(board.D12) # can be None to not use this pin
1415

1516
# give them all to our driver
16-
display = Adafruit_IL0373(152, 152, spi,
17+
print("Creating display")
18+
display = Adafruit_IL91874(176, 264, spi, # 2.7" Tri-color display
19+
#display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
1720
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
1821
rst_pin=rst, busy_pin=busy)
1922

23+
display.rotation = 2
24+
2025
# clear the buffer
26+
print("Clear buffer")
2127
display.fill(Adafruit_EPD.WHITE)
2228

23-
r_width = 5
24-
r_pos = display.height
25-
26-
color = Adafruit_EPD.BLACK
27-
while r_pos > display.height/2:
28-
if r_pos < display.height - 50:
29-
color = Adafruit_EPD.RED
30-
display.rect(display.width - r_pos,
31-
display.height - r_pos,
32-
display.width - 2*(display.width - r_pos),
33-
display.height - 2*(display.height - r_pos),
34-
color)
35-
r_pos = r_pos - r_width
29+
print("Draw Rectangles")
30+
display.fill_rect(5, 5, 10, 10, Adafruit_EPD.RED)
31+
display.rect(0, 0, 20, 30, Adafruit_EPD.BLACK)
32+
33+
print("Draw lines")
34+
display.line(0, 0, display.width-1, display.height-1, Adafruit_EPD.BLACK)
35+
display.line(0, display.height-1, display.width-1, 0, Adafruit_EPD.RED)
36+
37+
print("Draw text")
38+
display.text('hello world', 25, 10, Adafruit_EPD.BLACK)
39+
3640
display.display()

0 commit comments

Comments
 (0)