|
43 | 43 | from busdisplay import BusDisplay
|
44 | 44 |
|
45 | 45 | try:
|
46 |
| - import typing |
| 46 | + from typing import Any |
47 | 47 |
|
48 | 48 | from fourwire import FourWire
|
49 | 49 | except ImportError:
|
50 | 50 | pass
|
51 |
| - |
52 | 51 | __version__ = "0.0.0+auto.0"
|
53 | 52 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_ST7789.git"
|
54 | 53 |
|
|
57 | 56 | b"\x11\x80\xff" # _SLPOUT and Delay 500ms
|
58 | 57 | b"\x3a\x81\x55\x0a" # _COLMOD and Delay 10ms
|
59 | 58 | b"\x36\x01\x08" # _MADCTL
|
60 |
| - b"\x21\x80\x0a" # _INVON Hack and Delay 10ms |
61 | 59 | b"\x13\x80\x0a" # _NORON and Delay 10ms
|
62 |
| - b"\x36\x01\xc0" # _MADCTL |
63 | 60 | b"\x29\x80\xff" # _DISPON and Delay 500ms
|
64 | 61 | )
|
65 | 62 |
|
66 | 63 |
|
67 | 64 | # pylint: disable=too-few-public-methods
|
68 | 65 | class ST7789(BusDisplay):
|
69 |
| - """ST7789 driver""" |
70 |
| - |
71 |
| - def __init__(self, bus: FourWire, **kwargs) -> None: |
72 |
| - super().__init__(bus, _INIT_SEQUENCE, **kwargs) |
| 66 | + """ |
| 67 | + ST7789 driver |
| 68 | +
|
| 69 | + :param FourWire bus: bus that the display is connected to |
| 70 | + :param bool bgr: (Optional) An extra init sequence to append (default=True) |
| 71 | + :param bool invert: (Optional) Invert the colors (default=True) |
| 72 | + """ |
| 73 | + |
| 74 | + def __init__(self, bus: FourWire, *, bgr: bool = True, invert: bool = True, **kwargs: Any): |
| 75 | + init_sequence = _INIT_SEQUENCE |
| 76 | + if bgr: |
| 77 | + init_sequence += b"\x36\x01\xc0" # _MADCTL Default rotation plus BGR encoding |
| 78 | + else: |
| 79 | + init_sequence += b"\x36\x01\xc8" # _MADCTL Default rotation plus RGB encoding |
| 80 | + if invert: |
| 81 | + init_sequence += b"\x21\x00" # _INVON |
| 82 | + super().__init__(bus, init_sequence, **kwargs) |
0 commit comments