Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions TFT_Drivers/ILI9488_Rotation.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This is the command sequence that rotates the ILI9488 driver coordinate frame

writecommand(TFT_MADCTL);
rotation = m % 4;
rotation = m % 8;
switch (rotation) {
case 0: // Portrait
writedata(TFT_MAD_MX | TFT_MAD_BGR);
Expand All @@ -23,5 +23,25 @@
_width = TFT_HEIGHT;
_height = TFT_WIDTH;
break;
case 4: // Portrait mirrored
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR);
_width = TFT_WIDTH;
_height = TFT_HEIGHT;
break;
case 5: // Landscape (Portrait + 90) mirrored
writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_BGR);
_width = TFT_HEIGHT;
_height = TFT_WIDTH;
break;
case 6: // Inverter portrait mirrored
writedata(TFT_MAD_BGR);
_width = TFT_WIDTH;
_height = TFT_HEIGHT;
break;
case 7: // Inverted landscape mirrored
writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_BGR);
_width = TFT_HEIGHT;
_height = TFT_WIDTH;
break;
}