Skip to content

Adds support for the smaller 64x32 ssd1306 displays #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion adafruit_ssd1306.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ def power(self):

def init_display(self):
"""Base class to initialize display"""
# The various screen sizes available with the ssd1306 OLED driver
# chip require differing configuration values for the display clock
# div and com pin, which are listed below for reference and future
# compatibility:
# w, h: DISP_CLK_DIV COM_PIN_CFG
# 128, 64: 0x80 0x12
# 128, 32: 0x80 0x02
# 96, 16: 0x60 0x02
# 64, 48: 0x80 0x12
# 64, 32: 0x80 0x12
for cmd in (
SET_DISP | 0x00, # off
# address setting
Expand All @@ -103,7 +113,9 @@ def init_display(self):
SET_DISP_OFFSET,
0x00,
SET_COM_PIN_CFG,
0x02 if self.height == 32 or self.height == 16 else 0x12,
0x02
if (self.height == 32 or self.height == 16) and (self.width != 64)
else 0x12,
# timing and driving scheme
SET_DISP_CLK_DIV,
0x80,
Expand Down