diff --git a/OLEDDisplay.cpp b/OLEDDisplay.cpp index bffd337931be6eafa7a483e6813a7059544eb4eb..151aa5a584c4b66bff440fcdd0b62c9ddd6a1191 100644 --- a/OLEDDisplay.cpp +++ b/OLEDDisplay.cpp @@ -552,11 +552,21 @@ void OLEDDisplay::setContrast(char contrast) { sendCommand(contrast); } +void OLEDDisplay::resetOrientation() { + sendCommand(SEGREMAP); + sendCommand(COMSCANINC); //Reset screen rotation or mirroring +} + void OLEDDisplay::flipScreenVertically() { sendCommand(SEGREMAP | 0x01); sendCommand(COMSCANDEC); //Rotate screen 180 Deg } +void OLEDDisplay::mirrorScreen() { + sendCommand(SEGREMAP); + sendCommand(COMSCANDEC); //Mirror screen +} + void OLEDDisplay::clear(void) { memset(buffer, 0, displayBufferSize); } diff --git a/OLEDDisplay.h b/OLEDDisplay.h index fd6fb71c357dd7c8f3d5ce6b2fa6b31885f48d22..da09ae24cc22e8fcf519dfaae2d324b792b9e97a 100644 --- a/OLEDDisplay.h +++ b/OLEDDisplay.h @@ -209,9 +209,15 @@ class OLEDDisplay : public Print { // Set display contrast void setContrast(char contrast); + // Reset display rotation or mirroring + void resetOrientation(); + // Turn the display upside down void flipScreenVertically(); + // Mirror the display (to be used in a mirror or as a projector) + void mirrorScreen(); + // Write the buffer to the display memory virtual void display(void) = 0;