Skip to content

lvgl busdisplay byteswap fix - #11906

Merged
dhalbert merged 1 commit into
adafruit:mainfrom
FoamyGuy:busdisplay_byteswap_fix
Nov 18, 2026
Merged

dhalbert merged 1 commit into
adafruit:mainfrom
FoamyGuy:busdisplay_byteswap_fix

Conversation

@FoamyGuy

Copy link
Copy Markdown
Collaborator

This fixes an issue on current main with busdisplay running on top of LVGL using https://www.adafruit.com/product/1947

Here is a self contained reproducer that shows the incorrect colors drawn on the display when run under current main and the correct ones when run under a build with the fix.

import board
import displayio
import fourwire

import adafruit_ili9341

COLORS = (
    ("red", 0xFF0000),
    ("green", 0x00FF00),
    ("blue", 0x0000FF),
    ("white", 0xFFFFFF),
    ("navy", 0x181C28),
    ("black", 0x000000),
)

displayio.release_displays()
bus = fourwire.FourWire(board.SPI(), command=board.D9, chip_select=board.D10, baudrate=40_000_000)
display = adafruit_ili9341.ILI9341(bus, width=320, height=240)

palette = displayio.Palette(len(COLORS))
for i, (_, color) in enumerate(COLORS):
    palette[i] = color
band = 240 // len(COLORS)
bitmap = displayio.Bitmap(320, 240, len(COLORS))
for y in range(240):
    for x in range(320):
        bitmap[x, y] = min(y // band, len(COLORS) - 1)

group = displayio.Group()
group.append(displayio.TileGrid(bitmap, pixel_shader=palette))
display.root_group = group

print("bands, top to bottom:", ", ".join(name for name, _ in COLORS))
while True:
    pass

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@dhalbert
dhalbert merged commit 6f77cd4 into adafruit:main Nov 18, 2026
643 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants