Skip to content

Commit

Permalink
Merge pull request #53 from adamcandy/add-64x32-suppoort
Browse files Browse the repository at this point in the history
Adds support for the smaller 64x32 ssd1306 displays
  • Loading branch information
tannewt authored Dec 3, 2020
2 parents e385444 + dd1da50 commit a92acaf
Showing 1 changed file with 13 additions and 1 deletion.
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

0 comments on commit a92acaf

Please sign in to comment.