Page 1 of 1

Writing a custom library to mirror/flip text on an SSD1306 OLED display

Posted: Tue Jan 01, 2019 8:02 pm
by Nagup14
I have been searching for a library that will mirror text on an OLED display so that when I try to read the text on the screen from a mirror, it will appear the right way around, i.e. I can read the text on the screen when I look at it through a mirror but will appear flipped on the screen itself.

I haven't been able to find a library to do this or I probably haven't explored existing libraries enough but im thinking of creating my own library to allow me to do this. I am using an ESP32 chip and an SSD1306 64x32 px display running over i2c. Im looking for some help since I'm a beginner and I've never made a library for any chips from Espressif.

any help will be much appreciated

Re: Writing a custom library to mirror/flip text on an SSD1301 OLED display

Posted: Wed Jan 02, 2019 6:22 am
by costaud

Re: Writing a custom library to mirror/flip text on an SSD1301 OLED display

Posted: Wed Jan 02, 2019 9:22 am
by ESP_Sprite
Also know that it's usually trivial to modify an existing library to either write the pixels mirrored, or change a register setting in the oled controller so the display does the mirroring all by itself. No need to search for a dedicated library for that.

Re: Writing a custom library to mirror/flip text on an SSD1301 OLED display

Posted: Wed Jan 02, 2019 11:51 am
by Nagup14
costaud wrote:
Wed Jan 02, 2019 6:22 am
How about this one ?
https://github.com/espressif/esp-iot-so ... rs/ssd1306
Do I install this from the preferences menu in the Arduino IDE?

Re: Writing a custom library to mirror/flip text on an SSD1301 OLED display

Posted: Wed Jan 02, 2019 11:55 am
by Nagup14
ESP_Sprite wrote:
Wed Jan 02, 2019 9:22 am
Also know that it's usually trivial to modify an existing library to either write the pixels mirrored, or change a register setting in the oled controller so the display does the mirroring all by itself. No need to search for a dedicated library for that.
That would be really useful, im worried using another library in my code will cause compatibility issues. How do you suggest I go about changing a setting in the register, is there a guide online? I havent been able to find one on youtube and the datasheets for the display dont explicitly mention the ability to mirror text.

Re: Writing a custom library to mirror/flip text on an SSD1301 OLED display

Posted: Wed Jan 02, 2019 8:21 pm
by ESP_Sprite
I just checked the SSD1301 datasheet; it's actually one of the few controllers that does not have a register setting for this, sorry.

Re: Writing a custom library to mirror/flip text on an SSD1301 OLED display

Posted: Wed Jan 02, 2019 9:20 pm
by Nagup14
ESP_Sprite wrote:
Wed Jan 02, 2019 8:21 pm
I just checked the SSD1301 datasheet; it's actually one of the few controllers that does not have a register setting for this, sorry.
my bad, I actually meant 1306 i believe its called "segment re-map" but I dont know how to actually change the register setting

Re: Writing a custom library to mirror/flip text on an SSD1306 OLED display

Posted: Thu Jan 03, 2019 5:59 am
by chegewara

Re: Writing a custom library to mirror/flip text on an SSD1306 OLED display

Posted: Sat Jan 05, 2019 12:17 pm
by Nagup14
Ive found a solution, turns out it was in the library I was using already, just had to find all the commands and mix "flipDisplayVertically" and "mirrorScreen" works like a charm.

The library is "SSD1306.h"