diff --git a/.gitignore b/.gitignore index db3d538..871d9a7 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ _build # This file results from running `pip -e install .` in a local repository *.egg-info +.eggs # Virtual environment-specific files .env diff --git a/adafruit_rgb_display/st7735.py b/adafruit_rgb_display/st7735.py index 3be6446..ca86edc 100644 --- a/adafruit_rgb_display/st7735.py +++ b/adafruit_rgb_display/st7735.py @@ -132,7 +132,7 @@ def __init__( *, x_offset=0, y_offset=0, - rotation=0 + rotation=0, ): super().__init__( spi, @@ -195,9 +195,11 @@ def __init__( x_offset=0, y_offset=0, rotation=0, - bgr=False + bgr=False, + invert=False, ): self._bgr = bgr + self._invert = invert super().__init__( spi, dc, @@ -227,6 +229,8 @@ def init(self): self.write(command, data) if self._bgr: self.write(_MADCTL, b"\xc0") + if self._invert: + self.write(_INVON, None) class ST7735S(ST7735): @@ -280,7 +284,7 @@ def __init__( *, x_offset=2, y_offset=1, - rotation=0 + rotation=0, ): self._bl = bl # Turn on backlight diff --git a/examples/rgb_display_pillow_animated_gif.py b/examples/rgb_display_pillow_animated_gif.py index 7fca4ce..a268a2b 100644 --- a/examples/rgb_display_pillow_animated_gif.py +++ b/examples/rgb_display_pillow_animated_gif.py @@ -185,7 +185,9 @@ def run(self): # disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357 # disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R # disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R -# disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R +# disp = st7735.ST7735R(spi, rotation=90, bgr=True, width=80, # 0.96" MiniTFT Rev A ST7735R +# disp = st7735.ST7735R(spi, rotation=90, invert=True, width=80, # 0.96" MiniTFT Rev B ST7735R +# x_offset=26, y_offset=1, # disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351 # disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351 # disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331 diff --git a/examples/rgb_display_pillow_demo.py b/examples/rgb_display_pillow_demo.py index d5440bd..dc6eb56 100644 --- a/examples/rgb_display_pillow_demo.py +++ b/examples/rgb_display_pillow_demo.py @@ -47,7 +47,9 @@ # disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357 # disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R # disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R -# disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R +# disp = st7735.ST7735R(spi, rotation=90, bgr=True, width=80, # 0.96" MiniTFT Rev A ST7735R +# disp = st7735.ST7735R(spi, rotation=90, invert=True, width=80, # 0.96" MiniTFT Rev B ST7735R +# x_offset=26, y_offset=1, # disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351 # disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351 # disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331 diff --git a/examples/rgb_display_pillow_image.py b/examples/rgb_display_pillow_image.py index 04c40cc..1eb641c 100644 --- a/examples/rgb_display_pillow_image.py +++ b/examples/rgb_display_pillow_image.py @@ -42,7 +42,9 @@ # disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357 # disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R # disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R -# disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R +# disp = st7735.ST7735R(spi, rotation=90, bgr=True, width=80, # 0.96" MiniTFT Rev A ST7735R +# disp = st7735.ST7735R(spi, rotation=90, invert=True, width=80, # 0.96" MiniTFT Rev B ST7735R +# x_offset=26, y_offset=1, # disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351 # disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351 # disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331 diff --git a/examples/rgb_display_pillow_stats.py b/examples/rgb_display_pillow_stats.py index 577a5ec..748f2ca 100644 --- a/examples/rgb_display_pillow_stats.py +++ b/examples/rgb_display_pillow_stats.py @@ -44,7 +44,9 @@ # disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357 # disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R # disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R -# disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R +# disp = st7735.ST7735R(spi, rotation=90, bgr=True, width=80, # 0.96" MiniTFT Rev A ST7735R +# disp = st7735.ST7735R(spi, rotation=90, invert=True, width=80, # 0.96" MiniTFT Rev B ST7735R +# x_offset=26, y_offset=1, # disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351 # disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351 # disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331