a. Setting Portrait and Landscape Modes

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 09 - Setting Graphics Context >

a. Setting Portrait and Landscape Modes

CleO supports two types of orientation mode, Portrait (default) or Landscape mode. This section shows how to change the screen mode to landscape or portrait mode using the DisplayRotate() command.

 

 

Command Prototype

 

uint16_t DisplayRotate(int16_t Rotation, int16_t Flip)

 

Parameters

Description

Rotation

Values from 0 - 3

Flip

Value from 0 -1

 

 

Code

 

 

void setup()

{

 /* Initialize CleO - needs to be done only once */

 CleO.begin();

 

/* Set screen coordinate in landscape mode */

 CleO.DisplayRotate(2, 0);

 

/* Start building a screen frame */

 CleO.Start();

 

 CleO.StringExt(FONT_MEDIUM, 0, 0, LIGHT_GREEN, TL, 0, 0, "Landscape Mode");

 

 /* Display completed screen frame */

 CleO.Show();

 

 delay(3000);

 

/* Set screen coordinate in portrait mode */

 CleO.DisplayRotate(1, 0);

 

/* Start building a screen frame */

 CleO.Start();

 

 CleO.StringExt(FONT_MEDIUM, 0, 0, LIGHT_GREEN, TL, 0, 0, "Portrait Mode");

 

/* Display completed screen frame */

 CleO.Show();

}

 

void loop()

{

}

 

 

Description

 

The above code snippet uses the DisplayRotate() command to set the screen mode to landscape.

Setting the rotation value to two changes the (left, top) corner coordinates of the screen.

Subsequently, the display is set to Portrait mode by calling the same command but by passing one as the rotation value.

 

 

Output

 

Here is the output displayed upon executing the above code snippet -

 

LandscapeModes

 

PortraitModes