From 428e93b5cbe8891d4b08cd1ca4251692862694ba Mon Sep 17 00:00:00 2001 From: jgromes Date: Sun, 3 Jan 2021 14:19:48 +0100 Subject: [PATCH 1/2] Added support for 64x32 displays --- Adafruit_SSD1306.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Adafruit_SSD1306.cpp b/Adafruit_SSD1306.cpp index 0ab81a4c..33c8d32c 100644 --- a/Adafruit_SSD1306.cpp +++ b/Adafruit_SSD1306.cpp @@ -563,6 +563,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)) { + comPins = 0x12; + contrast = 0xCF; } else { // Other screen varieties -- TBD } @@ -925,13 +928,23 @@ uint8_t *Adafruit_SSD1306::getBuffer(void) { return buffer; } */ void Adafruit_SSD1306::display(void) { TRANSACTION_START - static const uint8_t PROGMEM dlist1[] = { - SSD1306_PAGEADDR, - 0, // Page start address - 0xFF, // Page end (not really, but works here) - SSD1306_COLUMNADDR, 0}; // Column start address - ssd1306_commandList(dlist1, sizeof(dlist1)); - ssd1306_command1(WIDTH - 1); // Column end address + if((WIDTH == 64) && (HEIGHT == 32)) { + static const uint8_t PROGMEM dlist1[] = { + SSD1306_PAGEADDR, + 0, // Page start address + 0xFF, // Page end (not really, but works here) + SSD1306_COLUMNADDR, 0x20}; // Column start address + ssd1306_commandList(dlist1, sizeof(dlist1)); + ssd1306_command1(0x20 + (WIDTH-1)); // Column end address + } else { + static const uint8_t PROGMEM dlist1[] = { + SSD1306_PAGEADDR, + 0, // Page start address + 0xFF, // Page end (not really, but works here) + SSD1306_COLUMNADDR, 0}; // Column start address + ssd1306_commandList(dlist1, sizeof(dlist1)); + ssd1306_command1(WIDTH - 1); // Column end address + } #if defined(ESP8266) // ESP8266 needs a periodic yield() call to avoid watchdog reset. From 80154152592a333a889c19370d1175241570f740 Mon Sep 17 00:00:00 2001 From: jgromes Date: Mon, 4 Jan 2021 21:43:38 +0100 Subject: [PATCH 2/2] Fixed formatting for clang check --- Adafruit_SSD1306.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Adafruit_SSD1306.cpp b/Adafruit_SSD1306.cpp index 33c8d32c..4695e866 100644 --- a/Adafruit_SSD1306.cpp +++ b/Adafruit_SSD1306.cpp @@ -928,14 +928,14 @@ uint8_t *Adafruit_SSD1306::getBuffer(void) { return buffer; } */ void Adafruit_SSD1306::display(void) { TRANSACTION_START - if((WIDTH == 64) && (HEIGHT == 32)) { + if ((WIDTH == 64) && (HEIGHT == 32)) { static const uint8_t PROGMEM dlist1[] = { SSD1306_PAGEADDR, - 0, // Page start address - 0xFF, // Page end (not really, but works here) + 0, // Page start address + 0xFF, // Page end (not really, but works here) SSD1306_COLUMNADDR, 0x20}; // Column start address ssd1306_commandList(dlist1, sizeof(dlist1)); - ssd1306_command1(0x20 + (WIDTH-1)); // Column end address + ssd1306_command1(0x20 + (WIDTH - 1)); // Column end address } else { static const uint8_t PROGMEM dlist1[] = { SSD1306_PAGEADDR,