Skip to content

Commit d7ebf6d

Browse files
authored
Merge pull request #110 from makermelissa/master
Added support for newer 0.96-inch display
2 parents 600f288 + ee68228 commit d7ebf6d

File tree

6 files changed

+20
-7
lines changed

6 files changed

+20
-7
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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def __init__(
132132
*,
133133
x_offset=0,
134134
y_offset=0,
135-
rotation=0
135+
rotation=0,
136136
):
137137
super().__init__(
138138
spi,
@@ -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,6 +229,8 @@ def init(self):
227229
self.write(command, data)
228230
if self._bgr:
229231
self.write(_MADCTL, b"\xc0")
232+
if self._invert:
233+
self.write(_INVON, None)
230234

231235

232236
class ST7735S(ST7735):
@@ -280,7 +284,7 @@ def __init__(
280284
*,
281285
x_offset=2,
282286
y_offset=1,
283-
rotation=0
287+
rotation=0,
284288
):
285289
self._bl = bl
286290
# Turn on backlight

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)