Unverified Commit aa7bad45 authored by Bodmer's avatar Bodmer Committed by GitHub

Merge pull request #1356 from DaveBben/hx8357D-rotation

Fix HX8375D rotation values
parents 0ad6de91 f3135aea
// This is the command sequence that rotates the ILI9481 driver coordinate frame
// This is the command sequence that rotates the HX8357D driver coordinate frame
writecommand(TFT_MADCTL);
rotation = m % 4;
switch (rotation) {
case 0: // Portrait
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_RGB);
_width = TFT_WIDTH;
_height = TFT_HEIGHT;
break;
case 1: // Landscape (Portrait + 90)
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_RGB);
_width = TFT_HEIGHT;
_height = TFT_WIDTH;
break;
case 2: // Inverter portrait
writedata(TFT_MAD_RGB);
_width = TFT_WIDTH;
_height = TFT_HEIGHT;
break;
case 3: // Inverted landscape
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_RGB);
_width = TFT_HEIGHT;
_height = TFT_WIDTH;
break;
}
writecommand(TFT_MADCTL);
rotation = m % 8;
switch (rotation)
{
case 0: // Portrait
writedata(TFT_MAD_BGR | TFT_MAD_MX);
_width = _init_width;
_height = _init_height;
break;
case 1: // Landscape (Portrait + 90)
writedata(TFT_MAD_BGR | TFT_MAD_MV);
_width = _init_height;
_height = _init_width;
break;
case 2: // Inverter portrait
writedata(TFT_MAD_BGR | TFT_MAD_MY);
_width = _init_width;
_height = _init_height;
break;
case 3: // Inverted landscape
writedata(TFT_MAD_BGR | TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_MY);
_width = _init_height;
_height = _init_width;
break;
case 4: // Portrait
writedata(TFT_MAD_BGR | TFT_MAD_MX | TFT_MAD_MY);
_width = _init_width;
_height = _init_height;
break;
case 5: // Landscape (Portrait + 90)
writedata(TFT_MAD_BGR | TFT_MAD_MV | TFT_MAD_MX);
_width = _init_height;
_height = _init_width;
break;
case 6: // Inverter portrait
writedata(TFT_MAD_BGR);
_width = _init_width;
_height = _init_height;
break;
case 7: // Inverted landscape
writedata(TFT_MAD_BGR | TFT_MAD_MV | TFT_MAD_MY);
_width = _init_height;
_height = _init_width;
break;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment