Files
TFT_eSPI/TFT_Drivers/HX8357D_Rotation.h
T
Bodmer 31b2de56c1 Update HX8357D driver to support RGB and BGR displays
In setup add the following lines:
// If green and blue swapped on display then change the RGB colour order
// Only uncomment ONE of the following options
#define TFT_RGB_ORDER TFT_RGB    //   Red-Green-Blue
//#define TFT_RGB_ORDER TFT_BGR    //   Blue-Green-RED
2022-03-12 20:04:41 +00:00

27 lines
780 B
C

// 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_COLOR_ORDER);
_width = TFT_WIDTH;
_height = TFT_HEIGHT;
break;
case 1: // Landscape (Portrait + 90)
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
_width = TFT_HEIGHT;
_height = TFT_WIDTH;
break;
case 2: // Inverter portrait
writedata(TFT_MAD_COLOR_ORDER);
_width = TFT_WIDTH;
_height = TFT_HEIGHT;
break;
case 3: // Inverted landscape
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
_width = TFT_HEIGHT;
_height = TFT_WIDTH;
break;
}