8000 displayio API update by FoamyGuy · Pull Request #101 · adafruit/Adafruit_CircuitPython_ImageLoad · GitHub
[go: up one dir, main page]

Skip to content

displayio API update #101

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 2 commits into from
May 30, 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
3 changes: 2 additions & 1 deletion examples/imageload_netpbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import adafruit_ili9341
import board
import displayio
import fourwire

import adafruit_imageload

Expand All @@ -23,7 +24,7 @@
tft_dc = board.D10

displayio.release_displays()
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display_bus = fourwire.FourWire(spi, command=tft_dc, chip_select=tft_cs)

display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240)

Expand Down
7 changes: 7 additions & 0 deletions tests/displayio_shared_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ def __init__(self, width: int, height: int, colors: int) -> None:
self.height = height
self.colors = colors
self.data = {}
bits = 1
while (colors - 1) >> bits:
if bits < 8:
bits = bits << 1
else:
bits += 8
self._bits_per_value = bits
Copy link
Contributor Author
@FoamyGuy FoamyGuy May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mimics the logic from blinka displayio here: https://github.com/adafruit/Adafruit_Blinka_Displayio/blob/01b274d3a058b8efb7b3c3638511724cbc290a7d/displayio/_bitmap.py#L64-L68

It may ultimately be worth spending a little time to try to update these tests to utilize Blinka Displayio instead of these one-off mocked implementations of core classes anywhere possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the tests failing was unrelated to the primary change in this PR. I believe the root cause of that is bitmaptools being added to Blinka Displayio since the last time these tests were run. The code for this test takes a path that involves using both these mocked Interface class, and the new implementations of bitmaptools which exposed that the Interface was missing this internal field that readinto is relying on.


def _abs_pos(self, width: int, height: int) -> int:
if height >= self.height:
Expand Down
0