diff --git a/README.md b/README.md index 52a8be9..ff3a6ca 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ > We just released version 4.0.0. Please have a look at our [upgrade guide](UPGRADE-4.0.md) -This is a driver for SSD1306 128x64 and 128x32 OLED displays running on the Arduino/ESP8266 & ESP32 and mbed-os platforms. +This is a driver for SSD1306 128x64, 128x32, 64x48 and 64x32 OLED displays running on the Arduino/ESP8266 & ESP32 and mbed-os platforms. Can be used with either the I2C or SPI version of the display. You can either download this library as a zip file and unpack it to your Arduino/libraries folder or find it in the Arduino library manager under "ESP8266 and ESP32 Oled Driver for SSD1306 display". For mbed-os a copy of the files are available as an mbed-os library. diff --git a/src/OLEDDisplay.cpp b/src/OLEDDisplay.cpp index 8e212ab..bf4a5ee 100644 --- a/src/OLEDDisplay.cpp +++ b/src/OLEDDisplay.cpp @@ -859,6 +859,10 @@ void OLEDDisplay::setGeometry(OLEDDISPLAY_GEOMETRY g, uint16_t width, uint16_t h this->displayWidth = 64; this->displayHeight = 48; break; + case GEOMETRY_64_32: + this->displayWidth = 64; + this->displayHeight = 32; + break; case GEOMETRY_RAWMODE: this->displayWidth = width > 0 ? width : 128; this->displayHeight = height > 0 ? height : 64; @@ -877,7 +881,10 @@ void OLEDDisplay::sendInitCommands(void) { sendCommand(this->height() - 1); sendCommand(SETDISPLAYOFFSET); sendCommand(0x00); - sendCommand(SETSTARTLINE); + if(geometry == GEOMETRY_64_32) + sendCommand(0x00); + else + sendCommand(SETSTARTLINE); sendCommand(CHARGEPUMP); sendCommand(0x14); sendCommand(MEMORYMODE); @@ -886,7 +893,7 @@ void OLEDDisplay::sendInitCommands(void) { sendCommand(COMSCANINC); sendCommand(SETCOMPINS); - if (geometry == GEOMETRY_128_64 || geometry == GEOMETRY_64_48) { + if (geometry == GEOMETRY_128_64 || geometry == GEOMETRY_64_48 || geometry == GEOMETRY_64_32) { sendCommand(0x12); } else if (geometry == GEOMETRY_128_32) { sendCommand(0x02); @@ -894,7 +901,7 @@ void OLEDDisplay::sendInitCommands(void) { sendCommand(SETCONTRAST); - if (geometry == GEOMETRY_128_64 || geometry == GEOMETRY_64_48) { + if (geometry == GEOMETRY_128_64 || geometry == GEOMETRY_64_48 || geometry == GEOMETRY_64_32) { sendCommand(0xCF); } else if (geometry == GEOMETRY_128_32) { sendCommand(0x8F); diff --git a/src/OLEDDisplay.h b/src/OLEDDisplay.h index 45d2f59..8500b76 100644 --- a/src/OLEDDisplay.h +++ b/src/OLEDDisplay.h @@ -139,6 +139,7 @@ enum OLEDDISPLAY_GEOMETRY { GEOMETRY_128_64 = 0, GEOMETRY_128_32 = 1, GEOMETRY_64_48 = 2, + GEOMETRY_64_32 = 3, GEOMETRY_RAWMODE = 4 }; diff --git a/src/SSD1306Spi.h b/src/SSD1306Spi.h index 7fb76d6..08cb4a8 100644 --- a/src/SSD1306Spi.h +++ b/src/SSD1306Spi.h @@ -130,7 +130,7 @@ class SSD1306Spi : public OLEDDisplay { sendCommand(PAGEADDR); sendCommand(0x0); - if (geometry == GEOMETRY_128_64 || geometry == GEOMETRY_64_48) { + if (geometry == GEOMETRY_128_64 || geometry == GEOMETRY_64_48 || geometry == GEOMETRY_64_32 ) { sendCommand(0x7); } else if (geometry == GEOMETRY_128_32) { sendCommand(0x3);