About display.display command of Adafruit_SSD1306.h

Hi all.

The Adafruit_SSD1306.h has a pair of commands: display.clearDisplay(); and display.display when declared: Adafruit_SSD1306 display(...); that works well in OLED. and seems to me the display.display meaning of active or "mandatory" display?

are there any corresponding commands to that two in TFT_eSPI.h? can I make the TFT be "mandatory display"?

Thanks
Adam

Not sure exactly what you are asking.

clearDisplay() and display() are functions within the Adafruit_SSD1306 library.

display.display() is calling the display() function for the specific display initialize with the name "display", such as

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3D ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

You can replace the name "display" with "OLED", or any other name you desire.

1 Like

Thanks.

what command in TFT_eSPI.h got the same function as display.clearDisplay() and display.display() does in Adafruit_SSD1306.h?

the tft.fillScreen(TFT_BLACK); = display.clearDisplay(); , I guess ?

what command = display.display(); in TFT_eSPI.h?

I don't think there is an equivalent to display.display(). The Adafruit_SSD1306 library builds up the image in a buffer in ram, the display() function sends the contents of that buffer to the display. The TFT_eSPI library does not use a buffer, everything is written directly to the display.

The nearest equivalent to a buffer in the TFT_eSPI library is the use of a "sprite", which lets you build up an image in a ram buffer then write that to the display, but the ram needed for a buffer with full 16-bit color is very large, limiting the buffer size to a small portion of most displays.

1 Like

Great. thank you for the clear explanation.

The reason I asked so is I got have another post which got problem of OLED and TFT, OLED shown good, TFT doesn't, I guess maybe the command issue?

The code shouldn't even compile if you are trying to use a function that does not exist in the library.

I used same code in both OLED and T-DisplayS3'sTFT, with modified each display section.
the modification is OK, because OLED/TFT both work.
but the TFT only shown some content, not all.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.