Explorar el Código

Add 64x32 OLED display support

PreciousRoy0 hace 1 año
padre
commit
18c7f13ddd
Se han modificado 1 ficheros con 12 adiciones y 2 borrados
  1. 12 2
      Adafruit_SSD1306.cpp

+ 12 - 2
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.