Skip to content

Commit 968a99c

Browse files
committed
Added support for newer 0.96-inch display
1 parent 600f288 commit 968a99c

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ _build
3434

3535
# This file results from running `pip -e install .` in a local repository
3636
*.egg-info
37+
.eggs
3738

3839
# Virtual environment-specific files
3940
.env

adafruit_rgb_display/st7735.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,11 @@ def __init__(
195195
x_offset=0,
196196
y_offset=0,
197197
rotation=0,
198-
bgr=False
198+
bgr=False,
199+
invert=False,
199200
):
200201
self._bgr = bgr
202+
self._invert = invert
201203
super().__init__(
202204
spi,
203205
dc,
@@ -227,7 +229,8 @@ def init(self):
227229
self.write(command, data)
228230
if self._bgr:
229231
self.write(_MADCTL, b"\xc0")
230-
232+
if self._invert:
233+
self.write(_INVON, None)
231234

232235
class ST7735S(ST7735):
233236
"""A simple driver for the ST7735S-based displays."""

examples/rgb_display_pillow_animated_gif.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ def run(self):
185185
# disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
186186
# disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
187187
# disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R
188-
# disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
188+
# disp = st7735.ST7735R(spi, rotation=90, bgr=True, width=80, # 0.96" MiniTFT Rev A ST7735R
189+
# disp = st7735.ST7735R(spi, rotation=90, invert=True, width=80, # 0.96" MiniTFT Rev B ST7735R
190+
# x_offset=26, y_offset=1,
189191
# disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351
190192
# disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351
191193
# disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331

examples/rgb_display_pillow_demo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
# disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
4848
# disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
4949
# disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R
50-
# disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
50+
# disp = st7735.ST7735R(spi, rotation=90, bgr=True, width=80, # 0.96" MiniTFT Rev A ST7735R
51+
# disp = st7735.ST7735R(spi, rotation=90, invert=True, width=80, # 0.96" MiniTFT Rev B ST7735R
52+
# x_offset=26, y_offset=1,
5153
# disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351
5254
# disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351
5355
# disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331

examples/rgb_display_pillow_image.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
# disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
4343
# disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
4444
# disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R
45-
# disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
45+
# disp = st7735.ST7735R(spi, rotation=90, bgr=True, width=80, # 0.96" MiniTFT Rev A ST7735R
46+
# disp = st7735.ST7735R(spi, rotation=90, invert=True, width=80, # 0.96" MiniTFT Rev B ST7735R
47+
# x_offset=26, y_offset=1,
4648
# disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351
4749
# disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351
4850
# disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331

examples/rgb_display_pillow_stats.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
# disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
4545
# disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
4646
# disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R
47-
# disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
47+
# disp = st7735.ST7735R(spi, rotation=90, bgr=True, width=80, # 0.96" MiniTFT Rev A ST7735R
48+
# disp = st7735.ST7735R(spi, rotation=90, invert=True, width=80, # 0.96" MiniTFT Rev B ST7735R
49+
# x_offset=26, y_offset=1,
4850
# disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351
4951
# disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351
5052
# disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331

0 commit comments

Comments
 (0)