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

added param to control ili9486 display inversion #180

Merged
merged 1 commit into from
Aug 30, 2024
Merged
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
10 changes: 8 additions & 2 deletions luma/lcd/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@ class ili9486(backlit_device, __framebuffer_mixin):
:type framebuffer: luma.core.framebuffer.framebuffer
:param bgr: Set to ``True`` if device pixels are BGR order (rather than RGB).
:type bgr: bool
:param invert: Set to ``False`` if device does not require inverted colors.
:type invert: bool
:param h_offset: Horizontal offset (in pixels) of screen to device memory
(default: 0).
:type h_offset: int
Expand All @@ -773,7 +775,8 @@ class ili9486(backlit_device, __framebuffer_mixin):
"""

def __init__(self, serial_interface=None, width=320, height=480, rotate=0,
framebuffer=None, h_offset=0, v_offset=0, bgr=False, **kwargs):
framebuffer=None, h_offset=0, v_offset=0, bgr=False, invert=True,
**kwargs):
super(ili9486, self).__init__(luma.lcd.const.ili9486, serial_interface, **kwargs)
self.capabilities(width, height, rotate, mode="RGB")
self.init_framebuffer(framebuffer, 25)
Expand Down Expand Up @@ -823,7 +826,10 @@ def offset(bbox):
self.command(0x11) # sleep out
sleep(0.150)
self.command(0x3a, 0x00, 0x66) # Interface Pixel Format 6-6-6
self.command(0x21) # Display inversion ON for LCD(B)

if invert:
self.command(0x21) # Display inversion ON for LCD(B)

self.command(0xc0, 0x00, 0x09, 0x00, 0x09) # Power Control 1
self.command(0xc1, 0x00, 0x41, 0x00, 0x00) # Power Control 2
self.command(0xc2, 0x00, 0x33) # Power Control 3 (for normal mode)
Expand Down
Loading