Skip to content

use new OnDiskBitmap API #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,21 @@ Usage Example

.. code-block: python

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

"""Simple test script for 2.13" 212x104 tri-color featherwing.

Supported products:
* Adafruit 2.13" Tri-Color FeatherWing
* https://www.adafruit.com/product/4128
"""

"""
import time

import board
import displayio
import fourwire

import adafruit_il0373

displayio.release_displays()
Expand All @@ -80,30 +84,24 @@ Usage Example
display_bus = fourwire.FourWire(board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000)
time.sleep(1)

display = adafruit_il0373.IL0373(display_bus, width=212, height=104, rotation=90,
highlight_color=0xff0000)
display = adafruit_il0373.IL0373(
display_bus, width=212, height=104, rotation=90, highlight_color=0xFF0000
)

g = displayio.Group()

f = open("/display-ruler.bmp", "rb")

pic = displayio.OnDiskBitmap(f)
# CircuitPython 6 & 7 compatible
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
)
# CircuitPython 7 compatible only
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.root_group = g

display.refresh()

print("refreshed")

time.sleep(120)


Documentation
=============

Expand Down
21 changes: 8 additions & 13 deletions examples/il0373_1.54_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,15 @@

g = displayio.Group()

with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
# CircuitPython 6 & 7 compatible
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
)
# CircuitPython 7 compatible only
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.root_group = g
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.refresh()
display.root_group = g

print("refreshed")
display.refresh()

time.sleep(120)
print("refreshed")

time.sleep(120)
24 changes: 7 additions & 17 deletions examples/il0373_2.13_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,13 @@
g = displayio.Group()

# Display a ruler graphic from the root directory of the CIRCUITPY drive
with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
# Create a Tilegrid with the bitmap and put in the displayio group
# CircuitPython 6 & 7 compatible
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
)
# CircuitPython 7 compatible only
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

# Place the display group on the screen
display.root_group = g
display.root_group = g

# Refresh the display to have it actually show the image
# NOTE: Do not refresh eInk displays sooner than 180 seconds
display.refresh()
print("refreshed")
display.refresh()

time.sleep(180)
print("refreshed")
time.sleep(180)
24 changes: 7 additions & 17 deletions examples/il0373_2.9_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,13 @@
g = displayio.Group()

# Display a ruler graphic from the root directory of the CIRCUITPY drive
with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
# Create a Tilegrid with the bitmap and put in the displayio group
# CircuitPython 6 & 7 compatible
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
)
# CircuitPython 7 compatible only
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

# Place the display group on the screen
display.root_group = g
display.root_group = g

# Refresh the display to have it actually show the image
# NOTE: Do not refresh eInk displays sooner than 180 seconds
display.refresh()
print("refreshed")
display.refresh()

time.sleep(180)
print("refreshed")
time.sleep(180)
21 changes: 7 additions & 14 deletions examples/il0373_2.9_grayscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,13 @@

g = displayio.Group()

with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
# CircuitPython 6 & 7 compatible
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
)
# CircuitPython 7 compatible only
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.root_group = g
display.root_group = g

display.refresh()
display.refresh()

print("refreshed")

time.sleep(120)
print("refreshed")
time.sleep(120)
19 changes: 7 additions & 12 deletions examples/il0373_flexible_2.13_monochrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,13 @@

g = displayio.Group()

with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
# CircuitPython 6 & 7 compatible
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
)
# CircuitPython 7 compatible only
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.root_group = g
display.root_group = g

display.refresh()
display.refresh()

time.sleep(120)
print("refreshed")
time.sleep(180)
19 changes: 7 additions & 12 deletions examples/il0373_flexible_2.9_monochrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,13 @@

g = displayio.Group()

with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
# CircuitPython 6 & 7 compatible
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
)
# CircuitPython 7 compatible only
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.root_group = g
display.root_group = g

display.refresh()
display.refresh()

time.sleep(120)
print("refreshed")
time.sleep(120)
21 changes: 7 additions & 14 deletions examples/il0373_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,13 @@

g = displayio.Group()

with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
# CircuitPython 6 & 7 compatible
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
)
# CircuitPython 7 compatible only
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.root_group = g
display.root_group = g

display.refresh()
display.refresh()

print("refreshed")

time.sleep(120)
print("refreshed")
time.sleep(120)