This commit is contained in:
Bodmer
2022-02-26 16:48:30 +00:00

View File

@@ -1,47 +1,26 @@
// This is the command sequence that rotates the HX8357D driver coordinate frame // This is the command sequence that rotates the HX8357D driver coordinate frame
writecommand(TFT_MADCTL); writecommand(TFT_MADCTL);
rotation = m % 8; rotation = m % 4;
switch (rotation) switch (rotation) {
{
case 0: // Portrait case 0: // Portrait
writedata(TFT_MAD_BGR | TFT_MAD_MX); writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_RGB);
_width = _init_width; _width = TFT_WIDTH;
_height = _init_height; _height = TFT_HEIGHT;
break; break;
case 1: // Landscape (Portrait + 90) case 1: // Landscape (Portrait + 90)
writedata(TFT_MAD_BGR | TFT_MAD_MV); writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_RGB);
_width = _init_height; _width = TFT_HEIGHT;
_height = _init_width; _height = TFT_WIDTH;
break; break;
case 2: // Inverter portrait case 2: // Inverter portrait
writedata(TFT_MAD_BGR | TFT_MAD_MY); writedata(TFT_MAD_RGB);
_width = _init_width; _width = TFT_WIDTH;
_height = _init_height; _height = TFT_HEIGHT;
break; break;
case 3: // Inverted landscape case 3: // Inverted landscape
writedata(TFT_MAD_BGR | TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_MY); writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_RGB);
_width = _init_height; _width = TFT_HEIGHT;
_height = _init_width; _height = TFT_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; break;
} }