Skip to content

Commit 3a823a4

Browse files
authored
Merge pull request #55 from philippkeller/master
Driver for ST7735S
2 parents 4674551 + 7753772 commit 3a823a4

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Port of display drivers from https://github.com/adafruit/micropython-adafruit-rg
1717

1818
.. note:: This driver currently won't work on micropython.org firmware, instead you want the micropython-adafruit-rgb-display driver linked above!
1919

20-
This CircuitPython driver currently supports displays that use the following display-driver chips: HX8353, HX8357, ILI9341, S6D02A1, ST7789, SSD1331, SSD1351, and ST7735.
20+
This CircuitPython driver currently supports displays that use the following display-driver chips: HX8353, HX8357, ILI9341, S6D02A1, ST7789, SSD1331, SSD1351, and ST7735 (including variants ST7735R and ST7735S).
2121

2222
Dependencies
2323
=============

adafruit_rgb_display/st7735.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,49 @@ def init(self):
193193
self.write(command, data)
194194
if self._bgr:
195195
self.write(_MADCTL, b'\xc0')
196+
197+
class ST7735S(ST7735):
198+
"""A simple driver for the ST7735S-based displays."""
199+
_INIT = (
200+
# Frame Rate
201+
(_FRMCTR1, b'\x01\x2c\x2d'),
202+
(_FRMCTR2, b'\x01\x2c\x2d'),
203+
(_FRMCTR3, b'\x01\x2c\x2d\x01\x2c\x2d'),
204+
205+
# Column inversion
206+
(_INVCTR, b'\x07'),
207+
208+
# Power Sequence
209+
(_PWCTR1, b'\xa2\x02\x84'),
210+
(_PWCTR2, b'\xc5'),
211+
(_PWCTR3, b'\x0a\x00'),
212+
(_PWCTR4, b'\x8a\x2a'),
213+
(_PWCTR5, b'\x8a\xee'),
214+
215+
# VCOM
216+
(_VMCTR1, b'\x0e'),
217+
218+
# Gamma
219+
(_GMCTRP1, b'\x0f\x1a\x0f\x18\x2f\x28\x20\x22'
220+
b'\x1f\x1b\x23\x37\x00\x07\x02\x10'),
221+
222+
(_GMCTRN1, b'\x0f\x1b\x0f\x17\x33\x2c\x29\x2e'
223+
b'\x30\x30\x39\x3f\x00\x07\x03\x10'),
224+
# 65k mode
225+
(_COLMOD, b'\x05'),
226+
# set scan direction: up to down, right to left
227+
(_MADCTL, b'\x60'),
228+
(_SLPOUT, None),
229+
(_DISPON, None),
230+
)
231+
232+
#pylint: disable-msg=useless-super-delegation, too-many-arguments
233+
def __init__(self, spi, dc, cs, bl, rst=None, width=128, height=160,
234+
baudrate=16000000, polarity=0, phase=0, *,
235+
x_offset=2, y_offset=1, rotation=0):
236+
self._bl = bl
237+
# Turn on backlight
238+
self._bl.switch_to_output(value=1)
239+
super().__init__(spi, dc, cs, rst, width, height,
240+
baudrate=baudrate, polarity=polarity, phase=phase,
241+
x_offset=x_offset, y_offset=y_offset, rotation=rotation)

0 commit comments

Comments
 (0)