adafruit / adafruit/Adafruit_CircuitPython_ILI9341

Make it easy to set MADCTL for rotation

Open
#26 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
17
Forks
11
PR merge metrics
No merged PRs in 30d

Description

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:
```python
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the driver's exposed initialization sequence, especially _INIT_SEQUENCE and its MADCTL command, then read the linked ILI9341 datasheet section 9.3 and page 209. Define an interface for supplying the MADCTL value without requiring callers to replace the initialization bytes themselves. Done means callers can select the controller rotation while leaving displayio rotation at 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.