|
3 | 3 | import board
|
4 | 4 | from adafruit_epd.epd import Adafruit_EPD
|
5 | 5 | from adafruit_epd.il0373 import Adafruit_IL0373
|
| 6 | +from adafruit_epd.il91874 import Adafruit_IL91874 |
6 | 7 |
|
7 | 8 | # create the spi device and pins we will need
|
8 | 9 | spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
|
9 | 10 | ecs = digitalio.DigitalInOut(board.D10)
|
10 | 11 | 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 |
14 | 15 |
|
15 | 16 | # 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 |
17 | 20 | cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
|
18 | 21 | rst_pin=rst, busy_pin=busy)
|
19 | 22 |
|
| 23 | +display.rotation = 2 |
| 24 | + |
20 | 25 | # clear the buffer
|
| 26 | +print("Clear buffer") |
21 | 27 | display.fill(Adafruit_EPD.WHITE)
|
22 | 28 |
|
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 | + |
36 | 40 | display.display()
|
0 commit comments