acidportal

- 😈 Worlds smallest Evil Portal on a LilyGo T-QT
git clone git://git.acid.vegas/acidportal.git
Log | Files | Refs | Archive | README | LICENSE

ST7789_2_Rotation.h (2722B)

      1   // This is the command sequence that rotates the ST7789 driver coordinate frame
      2 
      3   writecommand(TFT_MADCTL);
      4   rotation = m % 4;
      5   switch (rotation) {
      6     case 0: // Portrait
      7 #ifdef CGRAM_OFFSET
      8       if (_init_width == 135)
      9       {
     10         colstart = 52;
     11         rowstart = 40;
     12       }
     13       else if(_init_height == 280)
     14       {
     15         colstart = 0;
     16         rowstart = 20;
     17       }
     18       else if(_init_width == 172)
     19       {
     20         colstart = 34;
     21         rowstart = 0;
     22       }
     23       else if(_init_width == 170)
     24       {
     25         colstart = 35;
     26         rowstart = 0;
     27       }
     28       else
     29       {
     30         colstart = 0;
     31         rowstart = 0;
     32       }
     33 #endif
     34       writedata(TFT_MAD_COLOR_ORDER);
     35 
     36       _width  = _init_width;
     37       _height = _init_height;
     38       break;
     39 
     40     case 1: // Landscape (Portrait + 90)
     41 #ifdef CGRAM_OFFSET
     42       if (_init_width == 135)
     43       {
     44         colstart = 40;
     45         rowstart = 53;
     46       }
     47       else if(_init_height == 280)
     48       {
     49         colstart = 20;
     50         rowstart = 0;
     51       }
     52       else if(_init_width == 172)
     53       {
     54         colstart = 0;
     55         rowstart = 34;
     56       }
     57       else if(_init_width == 170)
     58       {
     59         colstart = 0;
     60         rowstart = 35;
     61       }
     62       else
     63       {
     64         colstart = 0;
     65         rowstart = 0;
     66       }
     67 #endif
     68       writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
     69 
     70       _width  = _init_height;
     71       _height = _init_width;
     72       break;
     73 
     74       case 2: // Inverter portrait
     75 #ifdef CGRAM_OFFSET
     76       if (_init_width == 135)
     77       {
     78         colstart = 53;
     79         rowstart = 40;
     80       }
     81       else if(_init_height == 280)
     82       {
     83         colstart = 0;
     84         rowstart = 20;
     85       }
     86       else if(_init_width == 172)
     87       {
     88         colstart = 34;
     89         rowstart = 0;
     90       }
     91       else if(_init_width == 170)
     92       {
     93         colstart = 35;
     94         rowstart = 0;
     95       }
     96       else
     97       {
     98         colstart = 0;
     99         rowstart = 80;
    100       }
    101 #endif
    102       writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
    103 
    104       _width  = _init_width;
    105       _height = _init_height;
    106        break;
    107     case 3: // Inverted landscape
    108 #ifdef CGRAM_OFFSET
    109       if (_init_width == 135)
    110       {
    111         colstart = 40;
    112         rowstart = 52;
    113       }
    114       else if(_init_height == 280)
    115       {
    116         colstart = 20;
    117         rowstart = 0;
    118       }
    119       else if(_init_width == 172)
    120       {
    121         colstart = 0;
    122         rowstart = 34;
    123       }
    124       else if(_init_width == 170)
    125       {
    126         colstart = 0;
    127         rowstart = 35;
    128       }
    129       else
    130       {
    131         colstart = 80;
    132         rowstart = 0;
    133       }
    134 #endif
    135       writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
    136 
    137       _width  = _init_height;
    138       _height = _init_width;
    139       break;
    140   }