acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
ILI9341_Rotation.h (2067B)
1 2 // This is the command sequence that rotates the ILI9341 driver coordinate frame 3 4 rotation = m % 8; // Limit the range of values to 0-7 5 6 writecommand(TFT_MADCTL); 7 switch (rotation) { 8 case 0: 9 #ifdef M5STACK 10 writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 11 #else 12 writedata(TFT_MAD_MX | TFT_MAD_COLOR_ORDER); 13 #endif 14 _width = _init_width; 15 _height = _init_height; 16 break; 17 case 1: 18 #ifdef M5STACK 19 writedata(TFT_MAD_COLOR_ORDER); 20 #else 21 writedata(TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 22 #endif 23 _width = _init_height; 24 _height = _init_width; 25 break; 26 case 2: 27 #ifdef M5STACK 28 writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_COLOR_ORDER); 29 #else 30 writedata(TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 31 #endif 32 _width = _init_width; 33 _height = _init_height; 34 break; 35 case 3: 36 #ifdef M5STACK 37 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 38 #else 39 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 40 #endif 41 _width = _init_height; 42 _height = _init_width; 43 break; 44 // These next rotations are for bottom up BMP drawing 45 case 4: 46 #ifdef M5STACK 47 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 48 #else 49 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 50 #endif 51 _width = _init_width; 52 _height = _init_height; 53 break; 54 case 5: 55 #ifdef M5STACK 56 writedata(TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 57 #else 58 writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_COLOR_ORDER); 59 #endif 60 _width = _init_height; 61 _height = _init_width; 62 break; 63 case 6: 64 #ifdef M5STACK 65 writedata(TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 66 #else 67 writedata(TFT_MAD_COLOR_ORDER); 68 #endif 69 _width = _init_width; 70 _height = _init_height; 71 break; 72 case 7: 73 #ifdef M5STACK 74 writedata(TFT_MAD_MX | TFT_MAD_COLOR_ORDER); 75 #else 76 writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 77 #endif 78 _width = _init_height; 79 _height = _init_width; 80 break; 81 82 }