Skip to content
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

Make it easy to set MADCTL for rotation #26

Open
jepler opened this issue Jun 3, 2021 · 4 comments
Open

Make it easy to set MADCTL for rotation #26

jepler opened this issue Jun 3, 2021 · 4 comments

Comments

@jepler
Copy link
Member

jepler commented Jun 3, 2021

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.

@makermelissa
Copy link
Contributor

Why are you using MADCTL for rotation? CircuitPython handles the rotation itself and then draws in the normal orientation. I believe this is to help with screen tearing according to @tannewt.

@jepler
Copy link
Member Author

jepler commented Jan 6, 2024

Using MADCTL for rotation usually performs better, especially for OnDiskBitmaps where displayio rotation gives pathologically poor behavior.

@tannewt
Copy link
Member

tannewt commented Jan 16, 2024

I never did the full tearing work I intended to do. So I wouldn't block this on that goal. Tearing happens with CP now and there isn't much we can do.

@makermelissa
Copy link
Contributor

Fair enough. Should be easy enough to refactor this driver to allow easier modification of MADCTL.

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

No branches or pull requests

3 participants