acidportal- 😈 Worlds smallest Evil Portal on a LilyGo T-QT |
git clone git://git.acid.vegas/acidportal.git |
Log | Files | Refs | Archive | README | LICENSE |
ST7735_Rotation.h (4634B)
1 2 // This is the command sequence that rotates the ST7735 driver coordinate frame 3 4 rotation = m % 4; // Limit the range of values to 0-3 5 6 writecommand(TFT_MADCTL); 7 switch (rotation) { 8 case 0: 9 if (tabcolor == INITR_BLACKTAB) { 10 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 11 } else if(tabcolor == INITR_GREENTAB2) { 12 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 13 colstart = 2; 14 rowstart = 1; 15 } else if(tabcolor == INITR_GREENTAB3) { 16 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 17 colstart = 2; 18 rowstart = 3; 19 } else if(tabcolor == INITR_GREENTAB128) { 20 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MH | TFT_MAD_COLOR_ORDER); 21 colstart = 0; 22 rowstart = 32; 23 } else if(tabcolor == INITR_GREENTAB160x80) { 24 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MH | TFT_MAD_COLOR_ORDER); 25 colstart = 26; 26 rowstart = 1; 27 } else if(tabcolor == INITR_REDTAB160x80) { 28 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MH | TFT_MAD_COLOR_ORDER); 29 colstart = 24; 30 rowstart = 0; 31 } else if(tabcolor == INITB) { 32 writedata(TFT_MAD_MX | TFT_MAD_COLOR_ORDER); 33 } else { 34 writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 35 } 36 _width = _init_width; 37 _height = _init_height; 38 break; 39 case 1: 40 if (tabcolor == INITR_BLACKTAB) { 41 writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 42 } else if(tabcolor == INITR_GREENTAB2) { 43 writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 44 colstart = 1; 45 rowstart = 2; 46 } else if(tabcolor == INITR_GREENTAB3) { 47 writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 48 colstart = 3; 49 rowstart = 2; 50 } else if(tabcolor == INITR_GREENTAB128) { 51 writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 52 colstart = 32; 53 rowstart = 0; 54 } else if(tabcolor == INITR_GREENTAB160x80) { 55 writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 56 colstart = 1; 57 rowstart = 26; 58 } else if(tabcolor == INITR_REDTAB160x80) { 59 writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 60 colstart = 0; 61 rowstart = 24; 62 } else if(tabcolor == INITB) { 63 writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 64 } else { 65 writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 66 } 67 _width = _init_height; 68 _height = _init_width; 69 break; 70 case 2: 71 if (tabcolor == INITR_BLACKTAB) { 72 writedata(TFT_MAD_COLOR_ORDER); 73 } else if(tabcolor == INITR_GREENTAB2) { 74 writedata(TFT_MAD_COLOR_ORDER); 75 colstart = 2; 76 rowstart = 1; 77 } else if(tabcolor == INITR_GREENTAB3) { 78 writedata(TFT_MAD_COLOR_ORDER); 79 colstart = 2; 80 rowstart = 1; 81 } else if(tabcolor == INITR_GREENTAB128) { 82 writedata(TFT_MAD_COLOR_ORDER); 83 colstart = 0; 84 rowstart = 0; 85 } else if(tabcolor == INITR_GREENTAB160x80) { 86 writedata(TFT_MAD_COLOR_ORDER); 87 colstart = 26; 88 rowstart = 1; 89 } else if(tabcolor == INITR_REDTAB160x80) { 90 writedata(TFT_MAD_COLOR_ORDER); 91 colstart = 24; 92 rowstart = 0; 93 } else if(tabcolor == INITB) { 94 writedata(TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 95 } else { 96 writedata(TFT_MAD_COLOR_ORDER); 97 } 98 _width = _init_width; 99 _height = _init_height; 100 break; 101 case 3: 102 if (tabcolor == INITR_BLACKTAB) { 103 writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 104 } else if(tabcolor == INITR_GREENTAB2) { 105 writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 106 colstart = 1; 107 rowstart = 2; 108 } else if(tabcolor == INITR_GREENTAB3) { 109 writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 110 colstart = 1; 111 rowstart = 2; 112 } else if(tabcolor == INITR_GREENTAB128) { 113 writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 114 colstart = 0; 115 rowstart = 0; 116 } else if(tabcolor == INITR_GREENTAB160x80) { 117 writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 118 colstart = 1; 119 rowstart = 26; 120 } else if(tabcolor == INITR_REDTAB160x80) { 121 writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 122 colstart = 0; 123 rowstart = 24; 124 } else if(tabcolor == INITB) { 125 writedata(TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 126 } else { 127 writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); 128 } 129 _width = _init_height; 130 _height = _init_width; 131 break; 132 }