Skip to content

Commit 5662cb0

Browse files
author
Melissa LeBlanc-Williams
committed
removed init byte code as an option
1 parent 1d3f15d commit 5662cb0

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

adafruit_st7735/st7735r.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@
8383
# pylint: disable=too-few-public-methods
8484
class ST7735R(displayio.Display):
8585
"""ST7735 driver for ST7735R"""
86-
def __init__(self, bus, *, init=None, **kwargs):
86+
def __init__(self, bus, *, bgr=False, **kwargs):
8787
"""
88-
:param bytes init: (Optional) An extra init sequence to append (default=None)
88+
:param bool bgr: (Optional) An extra init sequence to append (default=False)
8989
"""
9090
init_sequence = _INIT_SEQUENCE
91-
if init is not None:
92-
init_sequence += init
91+
if bgr:
92+
init_sequence += b"\x36\x01\xC0" # _MADCTL Default rotation plus BGR encoding
9393
super().__init__(bus, init_sequence, **kwargs)

examples/st7735_128x160_simpletest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
displayio.release_displays()
1515
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)
1616

17-
display = ST7735R(display_bus, width=128, height=160, init=b"\x36\x01\xC0")
17+
display = ST7735R(display_bus, width=128, height=160, bgr=True)
1818

1919
# Make the display context
2020
splash = displayio.Group(max_size=10)

examples/st7735_miniTFT_simpletest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
displayio.release_displays()
1313
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)
1414

15-
display = ST7735R(display_bus, width=160, height=80, rowstart=24, init=b"\x36\x01\x60")
15+
display = ST7735R(display_bus, width=160, height=80, colstart=24, rotation=90, bgr=True)
1616

1717
# Make the display context
1818
splash = displayio.Group(max_size=10)

examples/st7735_minitft_featherwing_simpletest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
2020

2121
ss.digital_write(reset_pin, True)
22-
display = ST7735R(display_bus, width=160, height=80, rowstart=24, init=b"\x36\x01\x60")
22+
display = ST7735R(display_bus, width=160, height=80, colstart=24, rotation=270, bgr=True)
2323

2424
# Make the display context
2525
splash = displayio.Group(max_size=10)

0 commit comments

Comments
 (0)