@@ -40,31 +40,35 @@ Usage Example
40
40
41
41
# create the spi device and pins we will need
42
42
spi = busio.SPI(board.SCK , MOSI = board.MOSI , MISO = board.MISO )
43
- ecs = digitalio.DigitalInOut(board.D10 )
44
- dc = digitalio.DigitalInOut(board.D9 )
45
- srcs = digitalio.DigitalInOut(board.D8)
46
- rst = digitalio.DigitalInOut(board.D7)
47
- busy = digitalio.DigitalInOut(board.D6)
43
+ ecs = digitalio.DigitalInOut(board.D12 )
44
+ dc = digitalio.DigitalInOut(board.D11 )
45
+ srcs = digitalio.DigitalInOut(board.D10) # can be None to use internal memory
46
+ rst = digitalio.DigitalInOut(board.D9) # can be None to not use this pin
47
+ busy = digitalio.DigitalInOut(board.D5) # can be None to not use this pin
48
48
49
49
# give them all to our driver
50
- display = Adafruit_IL0373(152 , 152 , rst, dc, busy, srcs, ecs, spi)
50
+ print (" Creating display" )
51
+ display = Adafruit_IL0373(104 , 212 , spi, # 2.13" Tri-color display
52
+ cs_pin = ecs, dc_pin = dc, sramcs_pin = srcs,
53
+ rst_pin = rst, busy_pin = busy)
54
+
55
+ display.rotation = 1
51
56
52
57
# clear the buffer
53
- display.clear_buffer()
58
+ print (" Clear buffer" )
59
+ display.fill(Adafruit_EPD.WHITE )
60
+ display.pixel(10 , 100 , Adafruit_EPD.BLACK )
54
61
55
- r_width = 5
56
- r_pos = display.height
62
+ print (" Draw Rectangles" )
63
+ display.fill_rect(5 , 5 , 10 , 10 , Adafruit_EPD.RED )
64
+ display.rect(0 , 0 , 20 , 30 , Adafruit_EPD.BLACK )
57
65
58
- # draw some rectangles!
59
- color = Adafruit_EPD.BLACK
60
- while r_pos > display.height/ 2 :
61
- if r_pos < display.height - 50 :
62
- color = Adafruit_EPD.RED
63
- display.rect(display.width - r_pos, display.height - r_pos,
64
- display.width - 2 * (display.width - r_pos),
65
- display.height - 2 * (display.height - r_pos), color)
66
- r_pos = r_pos - r_width
66
+ print (" Draw lines" )
67
+ display.line(0 , 0 , display.width- 1 , display.height- 1 , Adafruit_EPD.BLACK )
68
+ display.line(0 , display.height- 1 , display.width- 1 , 0 , Adafruit_EPD.RED )
67
69
70
+ print (" Draw text" )
71
+ display.text(' hello world' , 25 , 10 , Adafruit_EPD.BLACK )
68
72
display.display()
69
73
70
74
0 commit comments