acidportal

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

HX8357C_Rotation.h (1421B)

      1   // This is the command sequence that rotates the HX8357C driver coordinate frame
      2 
      3   writecommand(TFT_MADCTL);
      4   rotation = m % 8;
      5   switch (rotation) {
      6    case 0: // Portrait
      7      writedata(TFT_MAD_COLOR_ORDER | TFT_MAD_MX);
      8      _width  = _init_width;
      9      _height = _init_height;
     10      break;
     11    case 1: // Landscape (Portrait + 90)
     12      writedata(TFT_MAD_COLOR_ORDER | TFT_MAD_MV);
     13      _width  = _init_height;
     14      _height = _init_width;
     15      break;
     16    case 2: // Inverter portrait
     17      writedata( TFT_MAD_COLOR_ORDER | TFT_MAD_MY);
     18      _width  = _init_width;
     19      _height = _init_height;
     20     break;
     21    case 3: // Inverted landscape
     22      writedata(TFT_MAD_COLOR_ORDER | TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_MY);
     23      _width  = _init_height;
     24      _height = _init_width;
     25      break;
     26    case 4: // Portrait
     27      writedata(TFT_MAD_COLOR_ORDER | TFT_MAD_MX | TFT_MAD_MY);
     28      _width  = _init_width;
     29      _height = _init_height;
     30      break;
     31    case 5: // Landscape (Portrait + 90)
     32      writedata(TFT_MAD_COLOR_ORDER | TFT_MAD_MV | TFT_MAD_MX);
     33      _width  = _init_height;
     34      _height = _init_width;
     35      break;
     36    case 6: // Inverter portrait
     37      writedata( TFT_MAD_COLOR_ORDER);
     38      _width  = _init_width;
     39      _height = _init_height;
     40      break;
     41    case 7: // Inverted landscape
     42      writedata(TFT_MAD_COLOR_ORDER | TFT_MAD_MV | TFT_MAD_MY);
     43      _width  = _init_height;
     44      _height = _init_width;
     45      break;
     46   }
     47