adafruit / Adafruit_SSD1306

Arduino library for SSD1306 monochrome 128x64 and 128x32 OLEDs
http://www.adafruit.com/category/63_98
Other
1.74k stars 963 forks source link

display.display(), arbitrary display area refresh #249

Closed Kouzeru closed 1 year ago

Kouzeru commented 1 year ago

image

I'd hope to have the initial addresses can be set instead of just being fixed at column 0, and page 0, (0,0), being no way to change this without modifying the lib itself. I'm using 64x48 display, and the display is mapped at the center (being start address of page 0, and column 32).

I'm expecting this would work

//initial constants
#define SCREEN_WIDTH 64
#define SCREEN_HEIGHT 48

//setup code
  display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);

  display.ssd1306_command(SSD1306_PAGEADDR);
  display.ssd1306_command(0);
  display.ssd1306_command(5);

  display.ssd1306_command(SSD1306_COLUMNADDR);
  display.ssd1306_command(32);
  display.ssd1306_command(95);

but currently there is no way to do it.

DON'T give a lazy solution by responding this issue with SCREEN_WIDTH 128 as this would losing the point of this issue. I wanted the allocation of frame buffer perfectly fit for 64x48 display. And having arbitrary area refresh by making the page and column address can be manipulated would be very useful for this case.