Skip to content

Commit befedf2

Browse files
authored
Merge pull request #40 from makermelissa/master
Added SSD1331 and SSD1351 to Pillow Demos
2 parents aed3b0d + d348ebc commit befedf2

File tree

5 files changed

+45
-23
lines changed

5 files changed

+45
-23
lines changed

adafruit_rgb_display/ssd1331.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ class SSD1331(DisplaySPI):
122122

123123
# pylint: disable-msg=useless-super-delegation, too-many-arguments
124124
# super required to allow override of default values
125-
# All arguments needed due to driver requiring all the given data to function
126-
def __init__(self, spi, dc, cs, rst=None, width=96, height=64, rotation=0):
127-
super().__init__(spi, dc, cs, rst, width, height, rotation)
125+
def __init__(self, spi, dc, cs, rst=None, width=96, height=64,
126+
baudrate=16000000, polarity=0, phase=0, *, rotation=0):
127+
super().__init__(spi, dc, cs, rst, width, height,
128+
baudrate=baudrate, polarity=polarity, phase=phase,
129+
rotation=rotation)
128130

129131
# pylint: disable=no-member
130132
def write(self, command=None, data=None):

adafruit_rgb_display/ssd1351.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,10 @@ class SSD1351(DisplaySPI):
115115

116116
#pylint: disable-msg=useless-super-delegation, too-many-arguments
117117
def __init__(self, spi, dc, cs, rst=None, width=128, height=128,
118-
rotation=0):
119-
super().__init__(spi, dc, cs, rst, width, height, rotation)
118+
baudrate=16000000, polarity=0, phase=0, *,
119+
x_offset=0, y_offset=0, rotation=0):
120+
if baudrate > 16000000: # Limit to Display Max Baudrate
121+
baudrate = 16000000
122+
super().__init__(spi, dc, cs, rst, width, height,
123+
baudrate=baudrate, polarity=polarity, phase=phase,
124+
x_offset=x_offset, y_offset=y_offset, rotation=rotation)

examples/rgb_display_pillow_demo.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import adafruit_rgb_display.st7789 as st7789 # pylint: disable=unused-import
66
import adafruit_rgb_display.hx8357 as hx8357 # pylint: disable=unused-import
77
import adafruit_rgb_display.st7735 as st7735 # pylint: disable=unused-import
8+
import adafruit_rgb_display.ssd1351 as ssd1351 # pylint: disable=unused-import
9+
import adafruit_rgb_display.ssd1331 as ssd1331 # pylint: disable=unused-import
810

911
# First define some constants to allow easy resizing of shapes.
1012
BORDER = 20
@@ -22,13 +24,16 @@
2224
spi = board.SPI()
2325

2426
# Create the display:
25-
#disp = st7789.ST7789(spi, rotation=90 # 2.0" ST7789
26-
#disp = st7789.ST7789(spi, height=240, y_offset=80, rotation=90 # 1.3", 1.54" ST7789
27-
#disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
28-
#disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
27+
#disp = st7789.ST7789(spi, rotation=90 # 2.0" ST7789
28+
#disp = st7789.ST7789(spi, height=240, y_offset=80, rotation=90 # 1.3", 1.54" ST7789
29+
#disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
30+
#disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
2931
#disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R
30-
#disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
31-
disp = ili9341.ILI9341(spi, rotation=90, # 2.2", 2.4", 2.8", 3.2" ILI9341
32+
#disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
33+
#disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351
34+
#disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351
35+
#disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331
36+
disp = ili9341.ILI9341(spi, rotation=90, # 2.2", 2.4", 2.8", 3.2" ILI9341
3237
cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE)
3338

3439
# Create blank image for drawing.

examples/rgb_display_pillow_image.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import adafruit_rgb_display.st7789 as st7789 # pylint: disable=unused-import
66
import adafruit_rgb_display.hx8357 as hx8357 # pylint: disable=unused-import
77
import adafruit_rgb_display.st7735 as st7735 # pylint: disable=unused-import
8+
import adafruit_rgb_display.ssd1351 as ssd1351 # pylint: disable=unused-import
9+
import adafruit_rgb_display.ssd1331 as ssd1331 # pylint: disable=unused-import
810

911
# Configuration for CS and DC pins (these are PiTFT defaults):
1012
cs_pin = digitalio.DigitalInOut(board.CE0)
@@ -18,13 +20,16 @@
1820
spi = board.SPI()
1921

2022
# Create the display:
21-
#disp = st7789.ST7789(spi, rotation=90 # 2.0" ST7789
22-
#disp = st7789.ST7789(spi, height=240, y_offset=80, rotation=90 # 1.3", 1.54" ST7789
23-
#disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
24-
#disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
23+
#disp = st7789.ST7789(spi, rotation=90 # 2.0" ST7789
24+
#disp = st7789.ST7789(spi, height=240, y_offset=80, rotation=90 # 1.3", 1.54" ST7789
25+
#disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
26+
#disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
2527
#disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R
26-
#disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
27-
disp = ili9341.ILI9341(spi, rotation=90, # 2.2", 2.4", 2.8", 3.2" ILI9341
28+
#disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
29+
#disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351
30+
#disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351
31+
#disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331
32+
disp = ili9341.ILI9341(spi, rotation=90, # 2.2", 2.4", 2.8", 3.2" ILI9341
2833
cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE)
2934

3035
# Create blank image for drawing.

examples/rgb_display_pillow_stats.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import adafruit_rgb_display.st7789 as st7789 # pylint: disable=unused-import
88
import adafruit_rgb_display.hx8357 as hx8357 # pylint: disable=unused-import
99
import adafruit_rgb_display.st7735 as st7735 # pylint: disable=unused-import
10+
import adafruit_rgb_display.ssd1351 as ssd1351 # pylint: disable=unused-import
11+
import adafruit_rgb_display.ssd1331 as ssd1331 # pylint: disable=unused-import
1012

1113
# Configuration for CS and DC pins (these are PiTFT defaults):
1214
cs_pin = digitalio.DigitalInOut(board.CE0)
@@ -20,13 +22,16 @@
2022
spi = board.SPI()
2123

2224
# Create the display:
23-
#disp = st7789.ST7789(spi, rotation=90 # 2.0" ST7789
24-
#disp = st7789.ST7789(spi, height=240, y_offset=80, rotation=90 # 1.3", 1.54" ST7789
25-
#disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
26-
#disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
25+
#disp = st7789.ST7789(spi, rotation=90 # 2.0" ST7789
26+
#disp = st7789.ST7789(spi, height=240, y_offset=80, rotation=90 # 1.3", 1.54" ST7789
27+
#disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
28+
#disp = st7735.ST7735R(spi, rotation=90, # 1.8" ST7735R
2729
#disp = st7735.ST7735R(spi, rotation=270, height=128, x_offset=2, y_offset=3, # 1.44" ST7735R
28-
#disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
29-
disp = ili9341.ILI9341(spi, rotation=90, # 2.2", 2.4", 2.8", 3.2" ILI9341
30+
#disp = st7735.ST7735R(spi, rotation=90, bgr=True, # 0.96" MiniTFT ST7735R
31+
#disp = ssd1351.SSD1351(spi, rotation=180, # 1.5" SSD1351
32+
#disp = ssd1351.SSD1351(spi, height=96, y_offset=32, rotation=180, # 1.27" SSD1351
33+
#disp = ssd1331.SSD1331(spi, rotation=180, # 0.96" SSD1331
34+
disp = ili9341.ILI9341(spi, rotation=90, # 2.2", 2.4", 2.8", 3.2" ILI9341
3035
cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE)
3136

3237
# Create blank image for drawing.

0 commit comments

Comments
 (0)