diff --git a/adafruit_ssd1306.py b/adafruit_ssd1306.py index a95d815..0f8e705 100644 --- a/adafruit_ssd1306.py +++ b/adafruit_ssd1306.py @@ -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 @@ -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,