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

Add bgr and invert options #38

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions adafruit_ili9341.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
b"\xc1\x01\x10" # Power control SAP[2:0];BT[3:0]
b"\xc5\x02\x3e\x28" # VCM control
b"\xc7\x01\x86" # VCM control2
b"\x36\x01\x38" # Memory Access Control
b"\x37\x01\x00" # Vertical scroll zero
b"\x3a\x01\x55" # COLMOD: Pixel Format Set
b"\xb1\x02\x00\x18" # Frame Rate Control (In Normal Mode/Full Colors)
Expand All @@ -98,5 +97,19 @@ class ILI9341(BusDisplay):
:param FourWire bus: bus that the display is connected to
"""

def __init__(self, bus: FourWire, **kwargs: Any):
super().__init__(bus, _INIT_SEQUENCE, **kwargs)
def __init__(
self, bus: FourWire, *, bgr: bool = False, invert: bool = False, **kwargs: Any
):
init_sequence = _INIT_SEQUENCE
if bgr:
init_sequence += (
b"\x36\x01\x30" # _MADCTL Default rotation plus BGR encoding
)
else:
init_sequence += (
b"\x36\x01\x38" # _MADCTL Default rotation plus RGB encoding
)
if invert:
init_sequence += b"\x21\x00" # _INVON

super().__init__(bus, init_sequence, **kwargs)
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# Uncomment the below if you use native CircuitPython modules such as
# digitalio, micropython and busio. List the modules you use. Without it, the
# autodoc module docs will fail to generate with a warning.
# autodoc_mock_imports = ["digitalio", "busio"]
autodoc_mock_imports = ["displayio"]

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
Expand Down
Loading