76 #ifndef _TFT_ILI9163CLIB_H_ 77 #define _TFT_ILI9163CLIB_H_ 91 #define MAGENTA 0xF81F 95 #include "../Adafruit_GFX/Adafruit_GFX.h" 100 #define __128x160_BLUE_PCB__ //1.8 TFT MODULE 160x128 INTEFORM (with SDC slot) 103 #if defined(__SAM3X8E__) 104 #include <include/pio.h> 106 #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) 107 #define pgm_read_word(addr) (*(const unsigned short *)(addr)) 108 typedef unsigned char prog_uchar;
111 #include <avr/pgmspace.h> 113 #if defined(__MK20DX128__) || defined(__MK20DX256__) 115 #define CTAR_24MHz (SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0) | SPI_CTAR_DBR) 116 #define CTAR_16MHz (SPI_CTAR_PBR(1) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0) | SPI_CTAR_DBR) 117 #define CTAR_12MHz (SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0)) 118 #define CTAR_8MHz (SPI_CTAR_PBR(1) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0)) 119 #define CTAR_6MHz (SPI_CTAR_PBR(0) | SPI_CTAR_BR(1) | SPI_CTAR_CSSCK(1)) 120 #define CTAR_4MHz (SPI_CTAR_PBR(1) | SPI_CTAR_BR(1) | SPI_CTAR_CSSCK(1)) 124 #if defined(__128x160_BLUE_PCB__) 131 #define _TFTWIDTH 128//the REAL W resolution of the TFT 132 #define _TFTHEIGHT 160//the REAL H resolution of the TFT 133 #define _GRAMWIDTH 128 134 #define _GRAMHEIGH 160 135 #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH//*see note 1 136 #define __COLORSPC 0// 1:GBR - 0:RGB 137 #define __GAMMASET1 //uncomment for another gamma 138 #define __OFFSET 0//*see note 2 142 #elif defined(__144_RED_PCB__) 154 #define _TFTWIDTH 128//the REAL W resolution of the TFT 155 #define _TFTHEIGHT 128//the REAL H resolution of the TFT 156 #define _GRAMWIDTH 128 157 #define _GRAMHEIGH 160 158 #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH//*see note 1 159 #define __COLORSPC 1// 1:GBR - 0:RGB 160 #define __GAMMASET1 //uncomment for another gamma 161 #define __OFFSET 32//*see note 2 163 #elif defined (__22_RED_PCB__) 169 #define _TFTWIDTH 240//the REAL W resolution of the TFT 170 #define _TFTHEIGHT 320//the REAL H resolution of the TFT 171 #define _GRAMWIDTH 240 172 #define _GRAMHEIGH 320 173 #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH 174 #define __COLORSPC 1// 1:GBR - 0:RGB 175 #define __GAMMASET1 //uncomment for another gamma 178 #define _TFTWIDTH 128//128 179 #define _TFTHEIGHT 160//160 180 #define _GRAMWIDTH 128 181 #define _GRAMHEIGH 160 182 #define _GRAMSIZE _GRAMWIDTH * _GRAMHEIGH 183 #define __COLORSPC 1// 1:GBR - 0:RGB 195 #define CMD_NOP 0x00//Non operation 196 #define CMD_SWRESET 0x01//Soft Reset 197 #define CMD_SLPIN 0x10//Sleep ON 198 #define CMD_SLPOUT 0x11//Sleep OFF 199 #define CMD_PTLON 0x12//Partial Mode ON 200 #define CMD_NORML 0x13//Normal Display ON 201 #define CMD_DINVOF 0x20//Display Inversion OFF 202 #define CMD_DINVON 0x21//Display Inversion ON 203 #define CMD_GAMMASET 0x26//Gamma Set (0x01[1],0x02[2],0x04[3],0x08[4]) 204 #define CMD_DISPOFF 0x28//Display OFF 205 #define CMD_DISPON 0x29//Display ON 206 #define CMD_IDLEON 0x39//Idle Mode ON 207 #define CMD_IDLEOF 0x38//Idle Mode OFF 208 #define CMD_CLMADRS 0x2A//Column Address Set 209 #define CMD_PGEADRS 0x2B//Page Address Set 211 #define CMD_RAMWR 0x2C//Memory Write 212 #define CMD_RAMRD 0x2E//Memory Read 213 #define CMD_CLRSPACE 0x2D//Color Space : 4K/65K/262K 214 #define CMD_PARTAREA 0x30//Partial Area 215 #define CMD_VSCLLDEF 0x33//Vertical Scroll Definition 216 #define CMD_TEFXLON 0x34//Tearing Effect Line ON 217 #define CMD_TEFXLOF 0x35//Tearing Effect Line OFF 218 #define CMD_MADCTL 0x36//Memory Access Control 220 #define CMD_PIXFMT 0x3A//Interface Pixel Format 221 #define CMD_FRMCTR1 0xB1//Frame Rate Control (In normal mode/Full colors) 222 #define CMD_FRMCTR2 0xB2//Frame Rate Control(In Idle mode/8-colors) 223 #define CMD_FRMCTR3 0xB3//Frame Rate Control(In Partial mode/full colors) 224 #define CMD_DINVCTR 0xB4//Display Inversion Control 225 #define CMD_RGBBLK 0xB5//RGB Interface Blanking Porch setting 226 #define CMD_DFUNCTR 0xB6//Display Fuction set 5 227 #define CMD_SDRVDIR 0xB7//Source Driver Direction Control 228 #define CMD_GDRVDIR 0xB8//Gate Driver Direction Control 230 #define CMD_PWCTR1 0xC0//Power_Control1 231 #define CMD_PWCTR2 0xC1//Power_Control2 232 #define CMD_PWCTR3 0xC2//Power_Control3 233 #define CMD_PWCTR4 0xC3//Power_Control4 234 #define CMD_PWCTR5 0xC4//Power_Control5 235 #define CMD_VCOMCTR1 0xC5//VCOM_Control 1 236 #define CMD_VCOMCTR2 0xC6//VCOM_Control 2 237 #define CMD_VCOMOFFS 0xC7//VCOM Offset Control 238 #define CMD_PGAMMAC 0xE0//Positive Gamma Correction Setting 239 #define CMD_NGAMMAC 0xE1//Negative Gamma Correction Setting 240 #define CMD_GAMRSEL 0xF2//GAM_R_SEL 247 TFT_ILI9163C(uint8_t cspin,uint8_t dcpin,uint8_t rstpin);
251 setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1),
252 setCursor(int16_t x,int16_t y),
253 pushColor(uint16_t color),
254 fillScreen(uint16_t color=0x0000),
255 clearScreen(uint16_t color=0x0000),
256 drawPixel(int16_t x, int16_t y, uint16_t color),
257 drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
258 drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
259 fillRect(int16_t x, int16_t y, int16_t w, int16_t h,uint16_t color),
260 setRotation(uint8_t r),
261 invertDisplay(
boolean i);
262 uint16_t Color565(uint8_t r, uint8_t g, uint8_t b);
263 void setBitrate(uint32_t n);
266 uint8_t _Mactrl_Data;
267 uint8_t _colorspaceData;
268 void colorSpace(uint8_t cspace);
269 void writecommand(uint8_t c);
270 void writedata(uint8_t d);
271 void writedata16(uint16_t d);
273 bool boundaryCheck(int16_t x,int16_t y);
276 void spiwrite(uint8_t);
277 volatile uint8_t *dataport, *clkport, *csport, *rsport;
278 uint8_t _cs,_rs,_sid,_sclk,_rst;
279 uint8_t datapinmask, clkpinmask, cspinmask, rspinmask;
280 #endif // #ifdef __AVR__ 282 #if defined(__SAM3X8E__) 283 void spiwrite(uint8_t);
284 Pio *dataport, *clkport, *csport, *rsport;
285 uint8_t _cs,_rs,_sid,_sclk,_rst;
286 uint32_t datapinmask, clkpinmask, cspinmask, rspinmask;
287 #endif // #if defined(__SAM3X8E__) 289 #if defined(__MK20DX128__) || defined(__MK20DX256__) 290 uint8_t _cs,_rs,_sid,_sclk,_rst;
291 uint8_t pcs_data, pcs_command;
293 volatile uint8_t *datapin, *clkpin, *cspin, *rspin;
296 #if defined(__ESP8266_EX__) 297 void spiwrite(uint8_t);
298 volatile GPIO_REG_TYPE *csport, *rsport;
299 uint8_t _cs,_rs,_sid,_sclk,_rst;
300 GPIO_REG_TYPE cspinmask, rspinmask;
301 #endif // #ifdef __ESP8266_EX__ Definition: Adafruit_GFX.h:13
Definition: TFT_ILI9163C.h:243