Skip to content

Commit a92acaf

Browse files
authored
Merge pull request #53 from adamcandy/add-64x32-suppoort
Adds support for the smaller 64x32 ssd1306 displays
2 parents e385444 + dd1da50 commit a92acaf

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

adafruit_ssd1306.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ def power(self):
8989

9090
def init_display(self):
9191
"""Base class to initialize display"""
92+
# The various screen sizes available with the ssd1306 OLED driver
93+
# chip require differing configuration values for the display clock
94+
# div and com pin, which are listed below for reference and future
95+
# compatibility:
96+
# w, h: DISP_CLK_DIV COM_PIN_CFG
97+
# 128, 64: 0x80 0x12
98+
# 128, 32: 0x80 0x02
99+
# 96, 16: 0x60 0x02
100+
# 64, 48: 0x80 0x12
101+
# 64, 32: 0x80 0x12
92102
for cmd in (
93103
SET_DISP | 0x00, # off
94104
# address setting
@@ -103,7 +113,9 @@ def init_display(self):
103113
SET_DISP_OFFSET,
104114
0x00,
105115
SET_COM_PIN_CFG,
106-
0x02 if self.height == 32 or self.height == 16 else 0x12,
116+
0x02
117+
if (self.height == 32 or self.height == 16) and (self.width != 64)
118+
else 0x12,
107119
# timing and driving scheme
108120
SET_DISP_CLK_DIV,
109121
0x80,

0 commit comments

Comments
 (0)