Skip to content

Commit 5afd98c

Browse files
authored
Merge pull request #101 from FoamyGuy/displayio_api_updates
displayio API update
2 parents 845f402 + 0dbfcf1 commit 5afd98c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

examples/imageload_netpbm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import adafruit_ili9341
1616
import board
1717
import displayio
18+
import fourwire
1819

1920
import adafruit_imageload
2021

@@ -23,7 +24,7 @@
2324
tft_dc = board.D10
2425

2526
displayio.release_displays()
26-
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
27+
display_bus = fourwire.FourWire(spi, command=tft_dc, chip_select=tft_cs)
2728

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

tests/displayio_shared_bindings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ def __init__(self, width: int, height: int, colors: int) -> None:
5050
self.height = height
5151
self.colors = colors
5252
self.data = {}
53+
bits = 1
54+
while (colors - 1) >> bits:
55+
if bits < 8:
56+
bits = bits << 1
57+
else:
58+
bits += 8
59+
self._bits_per_value = bits
5360

5461
def _abs_pos(self, width: int, height: int) -> int:
5562
if height >= self.height:

0 commit comments

Comments
 (0)