kopia lustrzana https://github.com/peterhinch/micropython-nano-gui
ILI9486.py: Add COLOR_INVERT for ili9488.
rodzic
a7f383aac9
commit
c7228d9bb1
|
@ -55,14 +55,15 @@ def _lscopy(dest: ptr16, source: ptr8, lut: ptr16, ch: int):
|
||||||
class ILI9486(framebuf.FrameBuffer):
|
class ILI9486(framebuf.FrameBuffer):
|
||||||
|
|
||||||
lut = bytearray(32)
|
lut = bytearray(32)
|
||||||
|
COLOR_INVERT = 0
|
||||||
|
|
||||||
# Convert r, g, b in range 0-255 to a 16 bit colour value
|
# Convert r, g, b in range 0-255 to a 16 bit colour value
|
||||||
# LS byte goes into LUT offset 0, MS byte into offset 1
|
# LS byte goes into LUT offset 0, MS byte into offset 1
|
||||||
# Same mapping in linebuf so LS byte is shifted out 1st
|
# Same mapping in linebuf so LS byte is shifted out 1st
|
||||||
# ILI9486 expects RGB order. 8 bit register writes require padding
|
# ILI9486 expects RGB order. 8 bit register writes require padding
|
||||||
@staticmethod
|
@classmethod
|
||||||
def rgb(r, g, b):
|
def rgb(cls, r, g, b):
|
||||||
return (r & 0xF8) | (g & 0xE0) >> 5 | (g & 0x1C) << 11 | (b & 0xF8) << 5
|
return cls.COLOR_INVERT ^ ((r & 0xF8) | (g & 0xE0) >> 5 | (g & 0x1C) << 11 | (b & 0xF8) << 5)
|
||||||
|
|
||||||
# Transpose width & height for landscape mode
|
# Transpose width & height for landscape mode
|
||||||
def __init__(self, spi, cs, dc, rst, height=320, width=480, usd=False, init_spi=False):
|
def __init__(self, spi, cs, dc, rst, height=320, width=480, usd=False, init_spi=False):
|
||||||
|
|
Ładowanie…
Reference in New Issue