acidportal

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

SSD1351_Rotation.h (751B)

      1 
      2 // This is the command sequence that rotates the SSD1351 driver coordinate frame
      3 
      4   rotation = m % 4; // Limit the range of values to 0-3
      5 
      6   uint8_t madctl = 0x64;
      7 
      8   switch (rotation) {
      9     case 0:
     10       madctl |= 0x10;
     11       _width  = _init_width;
     12       _height = _init_height;
     13       break;
     14     case 1:
     15       madctl |= 0x13;
     16       _width  = _init_height;
     17       _height = _init_width;
     18       break;
     19     case 2:
     20       madctl |= 0x02;
     21       _width  = _init_width;
     22       _height = _init_height;
     23       break;
     24     case 3:
     25       madctl |= 0x01;
     26       _width  = _init_height;
     27       _height = _init_width;
     28       break;
     29   }
     30 
     31   writecommand(0xA0); // SETREMAP
     32   writedata(madctl);
     33   writecommand(0xA1); // STARTLINE
     34   writedata(rotation < 2 ? TFT_HEIGHT : 0);