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

ST7789_2_Defines.h (5784B)

      1 // Change the width and height if required (defined in portrait mode)
      2 // or use the constructor to over-ride defaults
      3 #ifndef TFT_WIDTH
      4   #define TFT_WIDTH  240
      5 #endif
      6 #ifndef TFT_HEIGHT
      7   #define TFT_HEIGHT 320
      8 #endif
      9 
     10 #if (TFT_HEIGHT == 240) && (TFT_WIDTH == 240)
     11   #ifndef CGRAM_OFFSET
     12     #define CGRAM_OFFSET
     13   #endif
     14 #endif
     15 
     16 // Adafruit 1.44 TFT support
     17 #if (TFT_HEIGHT == 240) && (TFT_WIDTH == 135)
     18   #ifndef CGRAM_OFFSET
     19     #define CGRAM_OFFSET
     20   #endif
     21 #endif
     22 
     23 // Adafruit 1.69 round corner TFT support
     24 #if (TFT_HEIGHT == 280) && (TFT_WIDTH == 240)
     25   #ifndef CGRAM_OFFSET
     26     #define CGRAM_OFFSET
     27   #endif
     28 #endif
     29 
     30 // 1.47" 172x320 Round Rectangle Color IPS TFT Display
     31 #if (TFT_HEIGHT == 320) && (TFT_WIDTH == 172)
     32   #ifndef CGRAM_OFFSET
     33     #define CGRAM_OFFSET
     34   #endif
     35 #endif
     36 
     37 #if (TFT_HEIGHT == 320) && (TFT_WIDTH == 170)
     38   #ifndef CGRAM_OFFSET
     39     #define CGRAM_OFFSET
     40   #endif
     41 #endif
     42 
     43 #if (TFT_HEIGHT == 300) && (TFT_WIDTH == 240)
     44   #ifndef CGRAM_OFFSET
     45     #define CGRAM_OFFSET
     46   #endif
     47 #endif
     48 
     49 // Delay between some initialisation commands
     50 #define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
     51 
     52 
     53 // Generic commands used by TFT_eSPI.cpp
     54 #define TFT_NOP     0x00
     55 #define TFT_SWRST   0x01
     56 
     57 #define TFT_SLPIN   0x10
     58 #define TFT_SLPOUT  0x11
     59 #define TFT_NORON   0x13
     60 
     61 #define TFT_INVOFF  0x20
     62 #define TFT_INVON   0x21
     63 #define TFT_DISPOFF 0x28
     64 #define TFT_DISPON  0x29
     65 #define TFT_CASET   0x2A
     66 #define TFT_PASET   0x2B
     67 #define TFT_RAMWR   0x2C
     68 #define TFT_RAMRD   0x2E
     69 #define TFT_MADCTL  0x36
     70 #define TFT_COLMOD  0x3A
     71 
     72 // Flags for TFT_MADCTL
     73 #define TFT_MAD_MY  0x80
     74 #define TFT_MAD_MX  0x40
     75 #define TFT_MAD_MV  0x20
     76 #define TFT_MAD_ML  0x10
     77 #define TFT_MAD_RGB 0x00
     78 #define TFT_MAD_BGR 0x08
     79 #define TFT_MAD_MH  0x04
     80 #define TFT_MAD_SS  0x02
     81 #define TFT_MAD_GS  0x01
     82 
     83 #ifdef TFT_RGB_ORDER
     84   #if (TFT_RGB_ORDER == 1)
     85     #define TFT_MAD_COLOR_ORDER TFT_MAD_RGB
     86   #else
     87     #define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
     88   #endif
     89 #else
     90   #ifdef CGRAM_OFFSET
     91     #define TFT_MAD_COLOR_ORDER TFT_MAD_BGR
     92   #else
     93     #define TFT_MAD_COLOR_ORDER TFT_MAD_RGB
     94   #endif
     95 #endif
     96 
     97 #define TFT_IDXRD   0x00 // ILI9341 only, indexed control register read
     98 
     99 #define ST_CMD_DELAY   0x80    // special signifier for command lists
    100 #define ST7789_240x240_XSTART 0
    101 #define ST7789_240x240_YSTART 0
    102 
    103 // ST7789 specific commands used in init
    104 #define ST7789_NOP			0x00
    105 #define ST7789_SWRESET		0x01
    106 #define ST7789_RDDID		0x04
    107 #define ST7789_RDDST		0x09
    108 
    109 #define ST7789_RDDPM		0x0A      // Read display power mode
    110 #define ST7789_RDD_MADCTL	0x0B      // Read display MADCTL
    111 #define ST7789_RDD_COLMOD	0x0C      // Read display pixel format
    112 #define ST7789_RDDIM		0x0D      // Read display image mode
    113 #define ST7789_RDDSM		0x0E      // Read display signal mode
    114 #define ST7789_RDDSR		0x0F      // Read display self-diagnostic result (ST7789V)
    115 
    116 #define ST7789_SLPIN		0x10
    117 #define ST7789_SLPOUT		0x11
    118 #define ST7789_PTLON		0x12
    119 #define ST7789_NORON		0x13
    120 
    121 #define ST7789_INVOFF		0x20
    122 #define ST7789_INVON		0x21
    123 #define ST7789_GAMSET		0x26      // Gamma set
    124 #define ST7789_DISPOFF		0x28
    125 #define ST7789_DISPON		0x29
    126 #define ST7789_CASET		0x2A
    127 #define ST7789_RASET		0x2B
    128 #define ST7789_RAMWR		0x2C
    129 #define ST7789_RGBSET		0x2D      // Color setting for 4096, 64K and 262K colors
    130 #define ST7789_RAMRD		0x2E
    131 
    132 #define ST7789_PTLAR		0x30
    133 #define ST7789_VSCRDEF		0x33      // Vertical scrolling definition (ST7789V)
    134 #define ST7789_TEOFF		0x34      // Tearing effect line off
    135 #define ST7789_TEON			0x35      // Tearing effect line on
    136 #define ST7789_MADCTL		0x36      // Memory data access control
    137 #define ST7789_IDMOFF		0x38      // Idle mode off
    138 #define ST7789_IDMON		0x39      // Idle mode on
    139 #define ST7789_RAMWRC		0x3C      // Memory write continue (ST7789V)
    140 #define ST7789_RAMRDC		0x3E      // Memory read continue (ST7789V)
    141 #define ST7789_COLMOD		0x3A
    142 
    143 #define ST7789_RAMCTRL		0xB0      // RAM control
    144 #define ST7789_RGBCTRL		0xB1      // RGB control
    145 #define ST7789_PORCTRL		0xB2      // Porch control
    146 #define ST7789_FRCTRL1		0xB3      // Frame rate control
    147 #define ST7789_PARCTRL		0xB5      // Partial mode control
    148 #define ST7789_GCTRL		0xB7      // Gate control
    149 #define ST7789_GTADJ		0xB8      // Gate on timing adjustment
    150 #define ST7789_DGMEN		0xBA      // Digital gamma enable
    151 #define ST7789_VCOMS		0xBB      // VCOMS setting
    152 #define ST7789_LCMCTRL		0xC0      // LCM control
    153 #define ST7789_IDSET		0xC1      // ID setting
    154 #define ST7789_VDVVRHEN		0xC2      // VDV and VRH command enable
    155 #define ST7789_VRHS			0xC3      // VRH set
    156 #define ST7789_VDVSET		0xC4      // VDV setting
    157 #define ST7789_VCMOFSET		0xC5      // VCOMS offset set
    158 #define ST7789_FRCTR2		0xC6      // FR Control 2
    159 #define ST7789_CABCCTRL		0xC7      // CABC control
    160 #define ST7789_REGSEL1		0xC8      // Register value section 1
    161 #define ST7789_REGSEL2		0xCA      // Register value section 2
    162 #define ST7789_PWMFRSEL		0xCC      // PWM frequency selection
    163 #define ST7789_PWCTRL1		0xD0      // Power control 1
    164 #define ST7789_VAPVANEN		0xD2      // Enable VAP/VAN signal output
    165 #define ST7789_CMD2EN		0xDF      // Command 2 enable
    166 #define ST7789_PVGAMCTRL	0xE0      // Positive voltage gamma control
    167 #define ST7789_NVGAMCTRL	0xE1      // Negative voltage gamma control
    168 #define ST7789_DGMLUTR		0xE2      // Digital gamma look-up table for red
    169 #define ST7789_DGMLUTB		0xE3      // Digital gamma look-up table for blue
    170 #define ST7789_GATECTRL		0xE4      // Gate control
    171 #define ST7789_SPI2EN		0xE7      // SPI2 enable
    172 #define ST7789_PWCTRL2		0xE8      // Power control 2
    173 #define ST7789_EQCTRL		0xE9      // Equalize time control
    174 #define ST7789_PROMCTRL		0xEC      // Program control
    175 #define ST7789_PROMEN		0xFA      // Program mode enable
    176 #define ST7789_NVMSET		0xFC      // NVM setting
    177 #define ST7789_PROMACT		0xFE      // Program action
    178