acidportal- 😈 Worlds smallest Evil Portal on a LilyGo T-QT |
git clone git://git.acid.vegas/acidportal.git |
Log | Files | Refs | Archive | README | LICENSE |
ST7796_Rotation.h (1854B)
1 2 // This is the command sequence that rotates the ST7796 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 writedata(TFT_MAD_MX | TFT_MAD_COLOR_ORDER); 10 _width = _init_width; 11 _height = _init_height; 12 #ifdef CGRAM_OFFSET 13 if (_init_width == 222) 14 { 15 colstart = 49; 16 rowstart = 0; 17 } 18 #endif 19 break; 20 case 1: 21 writedata(TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 22 _width = _init_height; 23 _height = _init_width; 24 #ifdef CGRAM_OFFSET 25 if (_init_width == 222) 26 { 27 colstart = 0; 28 rowstart = 49; 29 } 30 #endif 31 break; 32 case 2: 33 writedata(TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 34 _width = _init_width; 35 _height = _init_height; 36 #ifdef CGRAM_OFFSET 37 if (_init_width == 222) 38 { 39 colstart = 49; 40 rowstart = 0; 41 } 42 #endif 43 break; 44 case 3: 45 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 46 _width = _init_height; 47 _height = _init_width; 48 #ifdef CGRAM_OFFSET 49 if (_init_width == 222) 50 { 51 colstart = 0; 52 rowstart = 49; 53 } 54 #endif 55 break; 56 // These next rotations are for bottom up BMP drawing 57 case 4: 58 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 59 _width = _init_width; 60 _height = _init_height; 61 break; 62 case 5: 63 writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_COLOR_ORDER); 64 _width = _init_height; 65 _height = _init_width; 66 break; 67 case 6: 68 writedata(TFT_MAD_COLOR_ORDER); 69 _width = _init_width; 70 _height = _init_height; 71 break; 72 case 7: 73 writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 74 _width = _init_height; 75 _height = _init_width; 76 break; 77 78 }