Skip to content

Orientation

Configure

myScreen.setOrientation(ORIENTATION_LANDSCAPE);

setOrientation() sets the orientation of the logical screen compared to the physical screen.

  • Option 0 correspond to the physical screen as described in the data-sheet;

  • Options 1, 2 and 3 correspond to other orientations.

  • ORIENTATION_LANDSCAPE selects a landscape orientation, wider than high;

  • ORIENTATION_PORTRAIT selects a portrait orientation, higher than wide.

Use

uint8_t myOrientation = myScreen.getOrientation();
uint16_t x = myScreen.screenSizeX();
uint16_t Y = myScreen.screenSizeY();

getOrientation() returns the current orientation 0..3.

screenSizeX() takes the orientation into account and returns the width of the logical screen.

screenSizeY() takes the orientation into account and returns the height of the logical screen.

Example

This is the core of the code from example Common_Orientation.ino.

void displayOrientation()
{
    myScreen.selectFont(fontSans);

    for (uint8_t i = 0; i < 4; i++)
    {
        myScreen.setOrientation(i);
        myScreen.gText(4, 4, formatString("> Orientation %i", myScreen.getOrientation()));
    }

    myScreen.flush();
}