@@ -92,9 +92,11 @@ Usage Example
92
92
.. code-block :: python
93
93
94
94
import time
95
+
95
96
import board
96
97
import displayio
97
- import fourwire
98
+ from fourwire import FourWire
99
+
98
100
import adafruit_ek79686
99
101
100
102
# Used to ensure the display is free in CircuitPython
@@ -108,9 +110,7 @@ Usage Example
108
110
epd_busy = board.D6
109
111
110
112
# Create the displayio connection to the display pins
111
- display_bus = fourwire.FourWire(
112
- spi, command = epd_dc, chip_select = epd_cs, reset = epd_reset, baudrate = 1000000
113
- )
113
+ display_bus = FourWire(spi, command = epd_dc, chip_select = epd_cs, reset = epd_reset, baudrate = 1000000 )
114
114
time.sleep(1 ) # Wait a bit
115
115
116
116
# Create the display object - the third color is red (0xff0000)
@@ -128,28 +128,23 @@ Usage Example
128
128
129
129
130
130
# Display a ruler graphic from the root directory of the CIRCUITPY drive
131
- with open (" /display-ruler.bmp" , " rb" ) as f:
132
- pic = displayio.OnDiskBitmap(f)
133
- # Create a Tilegrid with the bitmap and put in the displayio group
134
- # CircuitPython 6 & 7 compatible
135
- t = displayio.TileGrid(
136
- pic, pixel_shader = getattr (pic, " pixel_shader" , displayio.ColorConverter())
137
- )
138
- # CircuitPython 7 compatible only
139
- # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
140
- g.append(t)
141
-
142
- # Place the display group on the screen (does not refresh)
143
- display.show(g)
144
-
145
- # Show the image on the display
146
- display.refresh()
147
-
148
- print (" refreshed" )
149
-
150
- # Do Not refresh the screen more often than every 180 seconds
151
- # for eInk displays! Rapid refreshes will damage the panel.
152
- time.sleep(180 )
131
+ pic = displayio.OnDiskBitmap(" /display-ruler.bmp" )
132
+ # Create a Tilegrid with the bitmap and put in the displayio group
133
+ t = displayio.TileGrid(pic, pixel_shader = pic.pixel_shader)
134
+ g.append(t)
135
+
136
+ # Place the display group on the screen (does not refresh)
137
+ display.root_group = g
138
+
139
+ # Show the image on the display
140
+ display.refresh()
141
+
142
+ print (" refreshed" )
143
+
144
+ # Do Not refresh the screen more often than every 180 seconds
145
+ # for eInk displays! Rapid refreshes will damage the panel.
146
+ time.sleep(180 )
147
+
153
148
154
149
155
150
Documentation
0 commit comments