acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

ST7796_Rotation.h (1382B)

      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       break;
     13     case 1:
     14       writedata(TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
     15       _width  = _init_height;
     16       _height = _init_width;
     17       break;
     18     case 2:
     19       writedata(TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
     20       _width  = _init_width;
     21       _height = _init_height;
     22       break;
     23     case 3:
     24       writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
     25       _width  = _init_height;
     26       _height = _init_width;
     27       break;
     28   // These next rotations are for bottom up BMP drawing
     29     case 4:
     30       writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
     31       _width  = _init_width;
     32       _height = _init_height;
     33       break;
     34     case 5:
     35       writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_COLOR_ORDER);
     36       _width  = _init_height;
     37       _height = _init_width;
     38       break;
     39     case 6:
     40       writedata(TFT_MAD_COLOR_ORDER);
     41       _width  = _init_width;
     42       _height = _init_height;
     43       break;
     44     case 7:
     45       writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
     46       _width  = _init_height;
     47       _height = _init_width;
     48       break;
     49 
     50   }