Skip to content

Commit 4ebf9c2

Browse files
authored
Merge pull request #15 from FoamyGuy/odb_api_update
use new OnDiskBitmap API
2 parents 776b932 + 95ad851 commit 4ebf9c2

File tree

3 files changed

+31
-31
lines changed

3 files changed

+31
-31
lines changed

README.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,20 @@ Usage Example
123123
124124
g = displayio.Group()
125125
126-
with open("/display-ruler.bmp", "rb") as f:
127-
pic = displayio.OnDiskBitmap(f)
128-
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
129-
g.append(t)
126+
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
127+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
128+
g.append(t)
130129
131-
display.root_group = g
130+
# Place the display group on the screen
131+
display.root_group = g
132132
133-
display.refresh()
133+
# Refresh the display to have it actually show the image
134+
# NOTE: Do not refresh eInk displays sooner than 180 seconds
135+
display.refresh()
136+
print("refreshed")
137+
138+
time.sleep(180)
134139
135-
time.sleep(120)
136140
137141
138142
Documentation

examples/uc8151d_2.9_color.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,16 @@
4444
g = displayio.Group()
4545

4646
# Display a ruler graphic from the root directory of the CIRCUITPY drive
47-
with open("/display-ruler.bmp", "rb") as f:
48-
pic = displayio.OnDiskBitmap(f)
49-
# Create a Tilegrid with the bitmap and put in the displayio group
50-
# CircuitPython 6 & 7 compatible
51-
t = displayio.TileGrid(
52-
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
53-
)
54-
# CircuitPython 7 compatible only
55-
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
56-
g.append(t)
47+
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
48+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
49+
g.append(t)
5750

58-
# Place the display group on the screen
59-
display.root_group = g
51+
# Place the display group on the screen
52+
display.root_group = g
6053

61-
# Refresh the display to have it actually show the image
62-
# NOTE: Do not refresh eInk displays sooner than 180 seconds
63-
display.refresh()
64-
print("refreshed")
54+
# Refresh the display to have it actually show the image
55+
# NOTE: Do not refresh eInk displays sooner than 180 seconds
56+
display.refresh()
57+
print("refreshed")
6558

66-
time.sleep(180)
59+
time.sleep(180)

examples/uc8151d_simpletest.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@
3737

3838
g = displayio.Group()
3939

40-
with open("/display-ruler.bmp", "rb") as f:
41-
pic = displayio.OnDiskBitmap(f)
42-
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
43-
g.append(t)
40+
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
41+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
42+
g.append(t)
4443

45-
display.root_group = g
44+
# Place the display group on the screen
45+
display.root_group = g
4646

47-
display.refresh()
47+
# Refresh the display to have it actually show the image
48+
# NOTE: Do not refresh eInk displays sooner than 180 seconds
49+
display.refresh()
50+
print("refreshed")
4851

49-
time.sleep(120)
52+
time.sleep(180)

0 commit comments

Comments
 (0)