Waveshare SSD1327 adafruit library?

So I’ve been messing with this ssd1327 library… Mega 2560 R3.

It works, but when I use over 114x128 resolution begin() returns false… I’ve just started poking around in the .cpp file, but I’m not versed on much of this. I also don’t know any good way to debug this.

Line 151 returns false.

Here is the cut down example code driving my SSD1327. What does work is very fast!

//#include <SPI.h>
#include <Adafruit_SSD1327.h>

// mega2560 r3 SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS).
#define OLED_CS 53
#define OLED_DC 7
#define OLED_RESET 8

// hardware SPI (breaks above 128x114)
Adafruit_SSD1327 display(114, 128, &SPI, OLED_DC, OLED_RESET, OLED_CS, 8000000);

void setup() {
Serial.begin(9600);
Serial.println(“SSD1327 OLED test”);

if ( ! display.begin(0x3D) ) {
Serial.println(“Unable to initialize OLED”);
while (1) yield();
}
display.clearDisplay();
display.display();
}

void loop() {
// draw many lines
testdrawline();
display.display();
delay(1000);
display.clearDisplay();
}

void testdrawline() {
for (uint8_t i = 0; i < display.width(); i += 4) {
display.drawLine(0, 0, i, display.height() - 1, SSD1327_WHITE);
display.display();
}
for (uint8_t i = 0; i < display.height(); i += 4) {
display.drawLine(0, 0, display.width() - 1, i, SSD1327_WHITE);
display.display();
}
delay(250);

display.clearDisplay();
}

Maybe 8kb is not enough SRAM for this…

Most libraries only support monochrome. i.e. a bit of a waste of money buying a Grayscale display.

128x128 monochrome buffer uses 2048 bytes.
128x128 grayscale buffer uses 8192 bytes.

So your Mega2560 should be fine with Adafruit_SSD1327 because it treats as monochrome.
But has no chance for grayscale.

Of course you can just treat as a write-only display e.g. draw text which rubs out anything underneath.
Graphics require that you don't need individual pixel addressing e.g. intersecting lines, circles, ...

U8g2lib also treats as monochrome. But can use small Page buffers which means you can draw monochrome graphics on a Uno.

David.

Works in software mode which is slower.

Thanks for your opinion I guess, the library makes a very good gray-scale effect regardless of how it's implemented. I just want this library to work because it seems faster, lighter, and produces better results in the demo for my purposes than the alternatives.

I could just put a frame over the display I guess.

My apologies. I have not tried the Adafruit library in real life. The docs "look" like monochrome.

I will see how it works on an ARM target i.e. with plenty of SRAM for grayscale buffers.
But not until tomorrow.

David.

It’s killing the sram.

serial:
freeMemory()=7515
OLED begin
freeMemory()=313

I wonder what else I could drive this with that’s comparable? I could try getting more SRAM which would be interesting on its own.

Ended up finding great success using this library, the included engine is pretty great too: