Skip to content

Make it easy to set MADCTL for rotation #26

Open
@jepler

Description

@jepler

The upper 3 bits of the MADCTL register can set a rotation that occurs within the LCD controller. Particularly when working with OnDiskBitmaps, displayio can be much more efficient when the displayio rotation is 0. By exposing the ability to modify the initialization string's MADCTL value, the more efficient in-controller rotation can be used instead.

Locally, I am using this code, but it's a bit gross:

def init_with_madctl(madctl):
    return adafruit_ili9341._INIT_SEQUENCE.replace(b'\x36\x01\x38',
            bytes([0x36, 1, madctl]))
…
display = displayio.Display(display_bus,
        init_with_madctl(0b010_110_00), width=320, height=240)

Section 9.3 and the figure on page 209 of https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf show how these 3 bits of MADCTL are interpreted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions