Skip to content

Commit 4b96507

Browse files
authored
Merge pull request #8 from FoamyGuy/odb_api_update
Use new OnDiskBitmap API
2 parents 1ff61a1 + 60aab00 commit 4b96507

File tree

2 files changed

+17
-26
lines changed

2 files changed

+17
-26
lines changed

README.rst

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ Usage Example
103103
# pylint: disable=no-member
104104
105105
import time
106+
106107
import board
107108
import displayio
108-
import adafruit_acep7in
109109
from fourwire import FourWire
110110
111+
import adafruit_acep7in
112+
111113
displayio.release_displays()
112114
113115
# This pinout works on a Feather RP2040 and may need to be altered for other boards.
@@ -117,29 +119,21 @@ Usage Example
117119
epd_reset = board.D11
118120
epd_busy = board.D12
119121
120-
display_bus = FourWire(
121-
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
122-
)
122+
display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
123123
124-
display = adafruit_acep7in.ACeP7In(
125-
display_bus, width=800, height=480, busy_pin=epd_busy
126-
)
124+
display = adafruit_acep7in.ACeP7In(display_bus, width=800, height=480, busy_pin=epd_busy)
127125
128126
g = displayio.Group()
129127
130-
fn = "/display-ruler-720p.bmp"
131-
132-
with open(fn, "rb") as f:
133-
pic = displayio.OnDiskBitmap(f)
134-
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
135-
g.append(t)
136-
137-
display.root_group = g
128+
pic = displayio.OnDiskBitmap("/display-ruler-720p.bmp")
129+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
130+
g.append(t)
138131
139-
display.refresh()
132+
display.root_group = g
140133
141-
time.sleep(120)
134+
display.refresh()
142135
136+
time.sleep(120)
143137
144138
Documentation
145139
=============

examples/acep7in_simpletest.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@
3030

3131
g = displayio.Group()
3232

33-
fn = "/display-ruler-720p.bmp"
33+
pic = displayio.OnDiskBitmap("/display-ruler-720p.bmp")
34+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
35+
g.append(t)
3436

35-
with open(fn, "rb") as f:
36-
pic = displayio.OnDiskBitmap(f)
37-
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
38-
g.append(t)
37+
display.root_group = g
3938

40-
display.root_group = g
39+
display.refresh()
4140

42-
display.refresh()
43-
44-
time.sleep(120)
41+
time.sleep(120)

0 commit comments

Comments
 (0)