From 18c7f13dddcfe4540d2ec4ba074e9f4fcecfecbe Mon Sep 17 00:00:00 2001 From: PreciousRoy0 Date: Wed, 1 Jan 2025 15:50:38 +0100 Subject: [PATCH] Add 64x32 OLED display support --- Adafruit_SSD1306.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Adafruit_SSD1306.cpp b/Adafruit_SSD1306.cpp index d686641..1f140bc 100644 --- a/Adafruit_SSD1306.cpp +++ b/Adafruit_SSD1306.cpp @@ -598,6 +598,9 @@ bool Adafruit_SSD1306::begin(uint8_t vcs, uint8_t addr, bool reset, } else if ((WIDTH == 96) && (HEIGHT == 16)) { comPins = 0x2; // ada x12 contrast = (vccstate == SSD1306_EXTERNALVCC) ? 0x10 : 0xAF; + } else if ((WIDTH == 64) && (HEIGHT == 32)) { //added this + comPins = 0x12; // ada x12 + contrast = (vccstate == SSD1306_EXTERNALVCC) ? 0x10 : 0xCF; } else { // Other screen varieties -- TBD } @@ -998,9 +1001,16 @@ void Adafruit_SSD1306::display(void) { SSD1306_PAGEADDR, 0, // Page start address 0xFF, // Page end (not really, but works here) - SSD1306_COLUMNADDR, 0}; // Column start address + SSD1306_COLUMNADDR}; // Column start address ssd1306_commandList(dlist1, sizeof(dlist1)); - ssd1306_command1(WIDTH - 1); // Column end address + + if (WIDTH == 64){ + ssd1306_command1(0x20); // Column start + ssd1306_command1(0x20 + WIDTH - 1); // Column end address + } else { + ssd1306_command1(0); // Column start + ssd1306_command1((WIDTH-1)); // Column end address + } #if defined(ESP8266) // ESP8266 needs a periodic yield() call to avoid watchdog reset.