I have edited the Library files “SeeedOLED.cpp” and “SeeedOLED.h” to rotate the display by 180 ° with the help of “remap”.
On “SeeedOLED.h” i have added:
void setRotation(bool Rotation);
On “SeeedOLED.cpp” i have added:
void SeeedOLED::setRotation(bool Rotation) // Rotation=true/false
{
if (Rotation == true) {
// Display rotation 180°
sendCommand(0xA8); // mux ratio(3F=[64 lines])
sendCommand(0x3F);
sendCommand(0xA0); // segment remap(top / bottom reversed)
sendCommand(0xC9);
sendCommand(0xA0); // segment remap(left / right reversed)
sendCommand(0xA1);
}
else {
// Display rotation 0°
sendCommand(0xA8); // mux ratio(3F=[64 lines])
sendCommand(0x3F);
sendCommand(0xA0); // segment remap(top / bottom normal)
sendCommand(0xC0);
sendCommand(0xA0); // segment remap(left / right normal)
sendCommand(0xA0);
}
setTextXY(0,0);
}
This is an edited OLED_Horizontal_Addressing_Mode example:
[code]#include <Wire.h>
#include <SeeedOLED.h>
void setup()
{
Wire.begin();
SeeedOled.init(); //initialze SEEED OLED display
DDRB|=0x21;
PORTB |= 0x21;
SeeedOled.clearDisplay(); //clear the screen and set start position to top left corner
SeeedOled.setNormalDisplay(); //Set display to Normal mode
SeeedOled.setHorizontalMode(); //Set addressing mode to Horizontal Mode
}
void loop()
{
SeeedOled.clearDisplay();
SeeedOled.setRotation(true);
SeeedOled.putString(“rotated orientation”);
delay(1500);
SeeedOled.clearDisplay();
SeeedOled.setRotation(false);
SeeedOled.putString(“normal orientation”);
delay(1500);
}[/code]
The display has contains much more functions than the Library.
For more features, I recommend a look at the datasheet of the display controller.
I hope it helps.
much greetings,
avoid