1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

Initial ESP8266 HW SPI implementation

ILI9341 lib as a client for SPI lib
This commit is contained in:
Andrey Filimonov
2015-04-01 07:10:31 +03:00
parent 61f3d12909
commit 4626a9df80
24 changed files with 2227 additions and 76 deletions

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2013 Seeed Technology Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,38 @@
TFT_Touch_Shield_V2
---------------------------------------------------------
[![TFT_Touch_Shield_V2](http://www.seeedstudio.com/depot/images/product/2.8touch%20shieldv2.jpg)](http://www.seeedstudio.com/depot/28-tft-touch-shield-v20-p-1286.html?cPath=34_36)
This is a multifunctional Arduino/Seeeduino/Arduino Mega compatible resistive touch screen. It can be used as display device or sketch pad.Compared with the previous version, 2.8TFT Touch Shield V1.0 , we replaced the screen driver with a more professional chip, ILI9341 driver, providing different pin-saving SPI communication without sacrificing the data transmitting speed. Due to the communication method change, programs developed for the original version need modifications before being transplanted to the new version. With a SD card module integrated also on this shield, this shield reserves great room for other expansions to your project.
**Features**
- Big screen for easy and comfortable experience
- Backlight controllable via programming
- 65535 rich colors display
- SPI pin-saving communication method
- Full screen touch active range
<br>
For more information, please refer to [wiki page](http://www.seeedstudio.com/wiki/2.8%27%27_TFT_Touch_Shield_v2.0).
----
This software is written by loovee [luweicong@seeedstudio.com](luweicong@seeedstudio.com "luweicong@seeedstudio.com") for seeed studio<br>
and is licensed under [The MIT License](http://opensource.org/licenses/mit-license.php). Check License.txt for more information.<br>
Contributing to this software is warmly welcomed. You can do this basically by<br>
[forking](https://help.github.com/articles/fork-a-repo), committing modifications and then [pulling requests](https://help.github.com/articles/using-pull-requests) (follow the links above<br>
for operating guide). Adding change log and your contact into file header is encouraged.<br>
Thanks for your contribution.
Seeed Studio is an open hardware facilitation company based in Shenzhen, China. <br>
Benefiting from local manufacture power and convenient global logistic system, <br>
we integrate resources to serve new era of innovation. Seeed also works with <br>
global distributors and partners to push open hardware movement.<br>

View File

@ -0,0 +1,569 @@
/*
2012 Copyright (c) Seeed Technology Inc.
Authors: Albert.Miao & Loovee,
Visweswara R (with initializtion code from TFT vendor)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc.,51 Franklin St,Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <TFTv2.h>
#include <SPI.h>
void TFT::TFTinit (void)
{
SPI.begin();
TFT_CS_HIGH;
TFT_DC_HIGH;
INT8U i=0, TFTDriver=0;
for(i=0;i<3;i++)
{
TFTDriver = readID();
}
delay(500);
sendCMD(0x01);
delay(200);
sendCMD(0xCF);
WRITE_DATA(0x00);
WRITE_DATA(0x8B);
WRITE_DATA(0X30);
sendCMD(0xED);
WRITE_DATA(0x67);
WRITE_DATA(0x03);
WRITE_DATA(0X12);
WRITE_DATA(0X81);
sendCMD(0xE8);
WRITE_DATA(0x85);
WRITE_DATA(0x10);
WRITE_DATA(0x7A);
sendCMD(0xCB);
WRITE_DATA(0x39);
WRITE_DATA(0x2C);
WRITE_DATA(0x00);
WRITE_DATA(0x34);
WRITE_DATA(0x02);
sendCMD(0xF7);
WRITE_DATA(0x20);
sendCMD(0xEA);
WRITE_DATA(0x00);
WRITE_DATA(0x00);
sendCMD(0xC0); /* Power control */
WRITE_DATA(0x1B); /* VRH[5:0] */
sendCMD(0xC1); /* Power control */
WRITE_DATA(0x10); /* SAP[2:0];BT[3:0] */
sendCMD(0xC5); /* VCM control */
WRITE_DATA(0x3F);
WRITE_DATA(0x3C);
sendCMD(0xC7); /* VCM control2 */
WRITE_DATA(0XB7);
sendCMD(0x36); /* Memory Access Control */
WRITE_DATA(0x08);
sendCMD(0x3A);
WRITE_DATA(0x55);
sendCMD(0xB1);
WRITE_DATA(0x00);
WRITE_DATA(0x1B);
sendCMD(0xB6); /* Display Function Control */
WRITE_DATA(0x0A);
WRITE_DATA(0xA2);
sendCMD(0xF2); /* 3Gamma Function Disable */
WRITE_DATA(0x00);
sendCMD(0x26); /* Gamma curve selected */
WRITE_DATA(0x01);
sendCMD(0xE0); /* Set Gamma */
WRITE_DATA(0x0F);
WRITE_DATA(0x2A);
WRITE_DATA(0x28);
WRITE_DATA(0x08);
WRITE_DATA(0x0E);
WRITE_DATA(0x08);
WRITE_DATA(0x54);
WRITE_DATA(0XA9);
WRITE_DATA(0x43);
WRITE_DATA(0x0A);
WRITE_DATA(0x0F);
WRITE_DATA(0x00);
WRITE_DATA(0x00);
WRITE_DATA(0x00);
WRITE_DATA(0x00);
sendCMD(0XE1); /* Set Gamma */
WRITE_DATA(0x00);
WRITE_DATA(0x15);
WRITE_DATA(0x17);
WRITE_DATA(0x07);
WRITE_DATA(0x11);
WRITE_DATA(0x06);
WRITE_DATA(0x2B);
WRITE_DATA(0x56);
WRITE_DATA(0x3C);
WRITE_DATA(0x05);
WRITE_DATA(0x10);
WRITE_DATA(0x0F);
WRITE_DATA(0x3F);
WRITE_DATA(0x3F);
WRITE_DATA(0x0F);
sendCMD(0x11); /* Exit Sleep */
delay(120);
sendCMD(0x29); /* Display on */
fillScreen();
}
INT8U TFT::readID(void)
{
INT8U i=0;
INT8U data[3] ;
INT8U ID[3] = {0x00, 0x93, 0x41};
INT8U ToF=1;
for(i=0;i<3;i++)
{
data[i]=Read_Register(0xd3,i+1);
if(data[i] != ID[i])
{
ToF=0;
}
}
if(!ToF) /* data!=ID */
{
Serial.print("Read TFT ID failed, ID should be 0x09341, but read ID = 0x");
for(i=0;i<3;i++)
{
Serial.print(data[i],HEX);
}
Serial.println();
}
return ToF;
}
void TFT::setCol(INT16U StartCol,INT16U EndCol)
{
sendCMD(0x2A); /* Column Command address */
sendData(StartCol);
sendData(EndCol);
}
void TFT::setPage(INT16U StartPage,INT16U EndPage)
{
sendCMD(0x2B); /* Column Command address */
sendData(StartPage);
sendData(EndPage);
}
void TFT::fillScreen(INT16U XL, INT16U XR, INT16U YU, INT16U YD, INT16U color)
{
unsigned long XY=0;
unsigned long i=0;
if(XL > XR)
{
XL = XL^XR;
XR = XL^XR;
XL = XL^XR;
}
if(YU > YD)
{
YU = YU^YD;
YD = YU^YD;
YU = YU^YD;
}
XL = constrain(XL, MIN_X,MAX_X);
XR = constrain(XR, MIN_X,MAX_X);
YU = constrain(YU, MIN_Y,MAX_Y);
YD = constrain(YD, MIN_Y,MAX_Y);
XY = (XR-XL+1);
XY = XY*(YD-YU+1);
Tft.setCol(XL,XR);
Tft.setPage(YU, YD);
Tft.sendCMD(0x2c);
TFT_DC_HIGH;
TFT_CS_LOW;
INT8U Hcolor = color>>8;
INT8U Lcolor = color&0xff;
for(i=0; i < XY; i++)
{
SPI.transfer(Hcolor);
SPI.transfer(Lcolor);
}
TFT_CS_HIGH;
}
void TFT::fillScreen(void)
{
Tft.setCol(0, 239);
Tft.setPage(0, 319);
Tft.sendCMD(0x2c); /* start to write to display ram */
TFT_DC_HIGH;
TFT_CS_LOW;
for(INT16U i=0; i<38400; i++)
{
SPI.transfer(0);
SPI.transfer(0);
SPI.transfer(0);
SPI.transfer(0);
}
TFT_CS_HIGH;
}
void TFT::setXY(INT16U poX, INT16U poY)
{
setCol(poX, poX);
setPage(poY, poY);
sendCMD(0x2c);
}
void TFT::setPixel(INT16U poX, INT16U poY,INT16U color)
{
sendCMD(0x2A); /* Column Command address */
sendData(poX);
sendData(poX);
sendCMD(0x2B); /* Column Command address */
sendData(poY);
sendData(poY);
sendCMD(0x2c);
sendData(color);
}
void TFT::drawChar( INT8U ascii, INT16U poX, INT16U poY,INT16U size, INT16U fgcolor)
{
if((ascii>=32)&&(ascii<=127))
{
;
}
else
{
ascii = '?'-32;
}
for (int i =0; i<FONT_X; i++ ) {
INT8U temp = pgm_read_byte(&simpleFont[ascii-0x20][i]);
for(INT8U f=0;f<8;f++)
{
if((temp>>f)&0x01)
{
fillRectangle(poX+i*size, poY+f*size, size, size, fgcolor);
}
}
}
}
void TFT::drawString(char *string,INT16U poX, INT16U poY, INT16U size,INT16U fgcolor)
{
while(*string)
{
drawChar(*string, poX, poY, size, fgcolor);
*string++;
if(poX < MAX_X)
{
poX += FONT_SPACE*size; /* Move cursor right */
}
}
}
//fillRectangle(poX+i*size, poY+f*size, size, size, fgcolor);
void TFT::fillRectangle(INT16U poX, INT16U poY, INT16U length, INT16U width, INT16U color)
{
fillScreen(poX, poX+length, poY, poY+width, color);
}
void TFT::drawHorizontalLine( INT16U poX, INT16U poY,
INT16U length,INT16U color)
{
setCol(poX,poX + length);
setPage(poY,poY);
sendCMD(0x2c);
for(int i=0; i<length; i++)
sendData(color);
}
void TFT::drawLine( INT16U x0,INT16U y0,INT16U x1, INT16U y1,INT16U color)
{
int x = x1-x0;
int y = y1-y0;
int dx = abs(x), sx = x0<x1 ? 1 : -1;
int dy = -abs(y), sy = y0<y1 ? 1 : -1;
int err = dx+dy, e2; /* error value e_xy */
for (;;)
{ /* loop */
setPixel(x0,y0,color);
e2 = 2*err;
if (e2 >= dy) { /* e_xy+e_x > 0 */
if (x0 == x1) break;
err += dy; x0 += sx;
}
if (e2 <= dx) { /* e_xy+e_y < 0 */
if (y0 == y1) break;
err += dx; y0 += sy;
}
}
}
void TFT::drawVerticalLine( INT16U poX, INT16U poY, INT16U length,INT16U color)
{
setCol(poX,poX);
setPage(poY,poY+length);
sendCMD(0x2c);
for(int i=0; i<length; i++)
sendData(color);
}
void TFT::drawRectangle(INT16U poX, INT16U poY, INT16U length, INT16U width,INT16U color)
{
drawHorizontalLine(poX, poY, length, color);
drawHorizontalLine(poX, poY+width, length, color);
drawVerticalLine(poX, poY, width,color);
drawVerticalLine(poX + length, poY, width,color);
}
void TFT::drawCircle(int poX, int poY, int r,INT16U color)
{
int x = -r, y = 0, err = 2-2*r, e2;
do {
setPixel(poX-x, poY+y,color);
setPixel(poX+x, poY+y,color);
setPixel(poX+x, poY-y,color);
setPixel(poX-x, poY-y,color);
e2 = err;
if (e2 <= y) {
err += ++y*2+1;
if (-x == y && e2 <= x) e2 = 0;
}
if (e2 > x) err += ++x*2+1;
} while (x <= 0);
}
void TFT::fillCircle(int poX, int poY, int r,INT16U color)
{
int x = -r, y = 0, err = 2-2*r, e2;
do {
drawVerticalLine(poX-x, poY-y, 2*y, color);
drawVerticalLine(poX+x, poY-y, 2*y, color);
e2 = err;
if (e2 <= y) {
err += ++y*2+1;
if (-x == y && e2 <= x) e2 = 0;
}
if (e2 > x) err += ++x*2+1;
} while (x <= 0);
}
void TFT::drawTraingle( int poX1, int poY1, int poX2, int poY2, int poX3, int poY3, INT16U color)
{
drawLine(poX1, poY1, poX2, poY2,color);
drawLine(poX1, poY1, poX3, poY3,color);
drawLine(poX2, poY2, poX3, poY3,color);
}
INT8U TFT::drawNumber(long long_num,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor)
{
INT8U char_buffer[10] = "";
INT8U i = 0;
INT8U f = 0;
if (long_num < 0)
{
f=1;
drawChar('-',poX, poY, size, fgcolor);
long_num = -long_num;
if(poX < MAX_X)
{
poX += FONT_SPACE*size; /* Move cursor right */
}
}
else if (long_num == 0)
{
f=1;
drawChar('0',poX, poY, size, fgcolor);
return f;
if(poX < MAX_X)
{
poX += FONT_SPACE*size; /* Move cursor right */
}
}
while (long_num > 0)
{
char_buffer[i++] = long_num % 10;
long_num /= 10;
}
f = f+i;
for(; i > 0; i--)
{
drawChar('0'+ char_buffer[i - 1],poX, poY, size, fgcolor);
if(poX < MAX_X)
{
poX+=FONT_SPACE*size; /* Move cursor right */
}
}
return f;
}
INT8U TFT::drawFloat(float floatNumber,INT8U decimal,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor)
{
INT16U temp=0;
float decy=0.0;
float rounding = 0.5;
INT8U f=0;
if(floatNumber<0.0)
{
drawChar('-',poX, poY, size, fgcolor);
floatNumber = -floatNumber;
if(poX < MAX_X)
{
poX+=FONT_SPACE*size; /* Move cursor right */
}
f =1;
}
for (INT8U i=0; i<decimal; ++i)
{
rounding /= 10.0;
}
floatNumber += rounding;
temp = (INT16U)floatNumber;
INT8U howlong=drawNumber(temp,poX, poY, size, fgcolor);
f += howlong;
if((poX+8*size*howlong) < MAX_X)
{
poX+=FONT_SPACE*size*howlong; /* Move cursor right */
}
if(decimal>0)
{
drawChar('.',poX, poY, size, fgcolor);
if(poX < MAX_X)
{
poX+=FONT_SPACE*size; /* Move cursor right */
}
f +=1;
}
decy = floatNumber-temp; /* decimal part, 4 */
for(INT8U i=0;i<decimal;i++)
{
decy *=10; /* for the next decimal */
temp = decy; /* get the decimal */
drawNumber(temp,poX, poY, size, fgcolor);
floatNumber = -floatNumber;
if(poX < MAX_X)
{
poX+=FONT_SPACE*size; /* Move cursor right */
}
decy -= temp;
}
f +=decimal;
return f;
}
INT8U TFT::drawFloat(float floatNumber,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor)
{
INT8U decimal=2;
INT16U temp=0;
float decy=0.0;
float rounding = 0.5;
INT8U f=0;
if(floatNumber<0.0) /* floatNumber < 0 */
{
drawChar('-',poX, poY, size, fgcolor); /* add a '-' */
floatNumber = -floatNumber;
if(poX < MAX_X)
{
poX+=FONT_SPACE*size; /* Move cursor right */
}
f =1;
}
for (INT8U i=0; i<decimal; ++i)
{
rounding /= 10.0;
}
floatNumber += rounding;
temp = (INT16U)floatNumber;
INT8U howlong=drawNumber(temp,poX, poY, size, fgcolor);
f += howlong;
if((poX+8*size*howlong) < MAX_X)
{
poX+=FONT_SPACE*size*howlong; /* Move cursor right */
}
if(decimal>0)
{
drawChar('.',poX, poY, size, fgcolor);
if(poX < MAX_X)
{
poX += FONT_SPACE*size; /* Move cursor right */
}
f +=1;
}
decy = floatNumber-temp; /* decimal part, */
for(INT8U i=0;i<decimal;i++)
{
decy *=10; /* for the next decimal */
temp = decy; /* get the decimal */
drawNumber(temp,poX, poY, size, fgcolor);
floatNumber = -floatNumber;
if(poX < MAX_X)
{
poX += FONT_SPACE*size; /* Move cursor right */
}
decy -= temp;
}
f += decimal;
return f;
}
TFT Tft=TFT();
/*********************************************************************************************************
END FILE
*********************************************************************************************************/

View File

@ -0,0 +1,222 @@
/*
2012 Copyright (c) Seeed Technology Inc.
Authors: Albert.Miao & Loovee,
Visweswara R (with initializtion code from TFT vendor)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified by Sermus for ESP8266
*/
#ifndef TFTv2_h
#define TFTv2_h
#if defined(ARDUINO) && ARDUINO >= 100
#define SEEEDUINO
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
#include <pgmspace.h>
#include <SPI.h>
//Basic Colors
#define RED 0xf800
#define GREEN 0x07e0
#define BLUE 0x001f
#define BLACK 0x0000
#define YELLOW 0xffe0
#define WHITE 0xffff
//Other Colors
#define CYAN 0x07ff
#define BRIGHT_RED 0xf810
#define GRAY1 0x8410
#define GRAY2 0x4208
//TFT resolution 240*320
#define MIN_X 0
#define MIN_Y 0
#define MAX_X 239
#define MAX_Y 319
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define TFT_CS_LOW {DDRE |= 0x08;PORTE &=~ 0x08;}
#define TFT_CS_HIGH {DDRE |= 0x08;PORTE |= 0x08;}
#define TFT_DC_LOW {DDRH |= 0x08;PORTH &=~ 0x08;}
#define TFT_DC_HIGH {DDRH |= 0x08;PORTH |= 0x08;}
#define TFT_BL_OFF {DDRH |= 0x10;PORTH &=~ 0x10;}
#define TFT_BL_ON {DDRH |= 0x10;PORTH |= 0x10;}
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A1 // must be an analog pin, use "An" notation!
#define YM 54 // can be a digital pin, this is A0
#define XP 57 // can be a digital pin, this is A3
#elif defined(__AVR_ATmega32U4__)
#define TFT_CS_LOW {DDRC |= 0x40;PORTC &=~ 0x40;}
#define TFT_CS_HIGH {DDRC |= 0x40;PORTC |= 0x40;}
#define TFT_DC_LOW {DDRD |= 0x80;PORTD &=~ 0x80;}
#define TFT_DC_HIGH {DDRD |= 0x80;PORTD |= 0x80;}
#define TFT_BL_OFF {DDRE |= 0x40;PORTE &=~ 0x40;}
#define TFT_BL_ON {DDRE |= 0x40;PORTE |= 0x40;}
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A1 // must be an analog pin, use "An" notation!
#define YM 18 // can be a digital pin, this is A0
#define XP 21 // can be a digital pin, this is A3
#else
#define TFT_CS_LOW //ESP8266 hspi has hardware controlled CS
#define TFT_CS_HIGH
#define TFT_DC_LOW pinMode(2, 0);
#define TFT_DC_HIGH pinMode(2, 1);
#define TFT_BL_OFF pinMode(0, 0);
#define TFT_BL_ON pinMode(0, 1);
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A1 // must be an analog pin, use "An" notation!
#define YM 14 // can be a digital pin, this is A0
#define XP 17 // can be a digital pin, this is A3
#endif
#define TS_MINX 116*2
#define TS_MAXX 890*2
#define TS_MINY 83*2
#define TS_MAXY 913*2
#ifndef INT8U
#define INT8U unsigned char
#endif
#ifndef INT16U
#define INT16U unsigned int
#endif
#define FONT_SPACE 6
#define FONT_X 8
#define FONT_Y 8
extern INT8U simpleFont[][8];
class TFT
{
private:
public:
inline void sendCMD(INT8U index)
{
TFT_DC_LOW;
TFT_CS_LOW;
SPI.transfer(index);
TFT_CS_HIGH;
}
inline void WRITE_DATA(INT8U data)
{
TFT_DC_HIGH;
TFT_CS_LOW;
SPI.transfer(data);
TFT_CS_HIGH;
}
inline void sendData(INT16U data)
{
INT8U data1 = data>>8;
INT8U data2 = data&0xff;
TFT_DC_HIGH;
TFT_CS_LOW;
SPI.transfer(data1);
SPI.transfer(data2);
TFT_CS_HIGH;
}
void WRITE_Package(INT16U *data, INT8U howmany)
{
INT16U data1 = 0;
INT8U data2 = 0;
TFT_DC_HIGH;
TFT_CS_LOW;
INT8U count=0;
for(count=0;count<howmany;count++)
{
data1 = data[count]>>8;
data2 = data[count]&0xff;
SPI.transfer(data1);
SPI.transfer(data2);
}
TFT_CS_HIGH;
}
INT8U Read_Register(INT8U Addr, INT8U xParameter)
{
INT8U data=0;
sendCMD(0xd9); /* ext command */
WRITE_DATA(0x10+xParameter); /* 0x11 is the first Parameter */
TFT_DC_LOW;
TFT_CS_LOW;
SPI.transfer(Addr);
TFT_DC_HIGH;
data = SPI.transfer(0);
TFT_CS_HIGH;
return data;
}
void TFTinit (void);
void setCol(INT16U StartCol,INT16U EndCol);
void setPage(INT16U StartPage,INT16U EndPage);
void setXY(INT16U poX, INT16U poY);
void setPixel(INT16U poX, INT16U poY,INT16U color);
void fillScreen(INT16U XL,INT16U XR,INT16U YU,INT16U YD,INT16U color);
void fillScreen(void);
INT8U readID(void);
void drawChar(INT8U ascii,INT16U poX, INT16U poY,INT16U size, INT16U fgcolor);
void drawString(char *string,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor);
void fillRectangle(INT16U poX, INT16U poY, INT16U length, INT16U width, INT16U color);
void drawLine(INT16U x0,INT16U y0,INT16U x1,INT16U y1,INT16U color);
void drawVerticalLine(INT16U poX, INT16U poY,INT16U length,INT16U color);
void drawHorizontalLine(INT16U poX, INT16U poY,INT16U length,INT16U color);
void drawRectangle(INT16U poX, INT16U poY, INT16U length,INT16U width,INT16U color);
void drawCircle(int poX, int poY, int r,INT16U color);
void fillCircle(int poX, int poY, int r,INT16U color);
void drawTraingle(int poX1, int poY1, int poX2, int poY2, int poX3, int poY3, INT16U color);
INT8U drawNumber(long long_num,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor);
INT8U drawFloat(float floatNumber,INT8U decimal,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor);
INT8U drawFloat(float floatNumber,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor);
};
extern TFT Tft;
#endif
/*********************************************************************************************************
END FILE
*********************************************************************************************************/

View File

@ -0,0 +1,32 @@
/* Demo of draw circle's APP
drawCircle(int poX, int poY, int r,INT16U color);
fillCircle(int poX, int poY, int r,INT16U color);
*/
#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>
void setup()
{
TFT_BL_ON; //turn on the background light
Tft.TFTinit(); //init TFT library
Tft.drawCircle(100, 100, 30,YELLOW); //center: (100, 100), r = 30 ,color : YELLOW
Tft.drawCircle(100, 200, 40,CYAN); // center: (100, 200), r = 10 ,color : CYAN
Tft.fillCircle(200, 100, 30,RED); //center: (200, 100), r = 30 ,color : RED
Tft.fillCircle(200, 200, 30,BLUE); //center: (200, 200), r = 30 ,color : BLUE
}
void loop()
{
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/

View File

@ -0,0 +1,31 @@
/* Demo of draw line's APP
drawLine(unsigned int x0,unsigned int y0,unsigned int x1,unsigned int y1,unsigned int color);
drawVerticalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color);
drawHorizontalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color);
*/
#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>
void setup()
{
TFT_BL_ON; // turn on the background light
Tft.TFTinit(); //init TFT library
Tft.drawLine(0,0,239,319,RED); //start: (0, 0) end: (239, 319), color : RED
Tft.drawVerticalLine(60,100,100,GREEN); // Draw a vertical line
// start: (60, 100) length: 100 color: green
Tft.drawHorizontalLine(30,60,150,BLUE); //Draw a horizontal line
//start: (30, 60), high: 150, color: blue
}
void loop()
{
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/

View File

@ -0,0 +1,40 @@
/* draw number's APP
drawNumber(long long_num,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor);
drawFloat(float floatNumber,INT8U decimal,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor);
drawFloat(float floatNumber,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor);
*/
#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>
void setup()
{
TFT_BL_ON; // turn on the background light
Tft.TFTinit(); // init TFT library
Tft.drawNumber(1024, 0, 0, 1, RED); // draw a integer: 1024, Location: (0, 0), size: 1, color: RED
Tft.drawNumber(1024, 0, 20, 2, BLUE); // draw a integer: 1024, Location: (0, 20), size: 2, color: BLUE
Tft.drawNumber(1024, 0, 50, 3, GREEN); // draw a integer: 1024, Location: (0, 50), size: 3, color: GREEN
Tft.drawNumber(1024, 0, 90, 4, BLUE); // draw a integer: 1024, Location: (0, 90), size:4, color: BLUE
Tft.drawFloat(1.2345, 0, 150, 4, YELLOW); // draw a float number: 1.2345, Location: (0, 150), size: 4, color: YELLOW
Tft.drawFloat(1.2345, 2, 0, 200, 4, BLUE); // draw a float number: 1.2345: Location: (0, 200), size: 4, decimal: 2, color: BLUE
Tft.drawFloat(1.2345, 4, 0, 250, 4, RED); // draw a float number: 1.2345 Location: (0, 250), size: 4, decimal: 4, color: RED
}
void loop()
{
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/

View File

@ -0,0 +1,26 @@
/* Draw Boxes - Demonstrate drawRectangle and fillRectangle
fillScreen(INT16U XL,INT16U XR,INT16U YU,INT16U YD,INT16U color);
fillRectangle(INT16U poX, INT16U poY, INT16U length, INT16U width, INT16U color);
drawRectangle(INT16U poX, INT16U poY, INT16U length,INT16U width,INT16U color);
*/
#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>
void setup()
{
TFT_BL_ON; // turn on the background light
Tft.TFTinit(); // init TFT library
Tft.fillScreen(80, 160, 50, 150,RED);
Tft.fillRectangle(30, 120, 100,65,YELLOW);
Tft.drawRectangle(100, 170, 120,60,BLUE);
}
void loop()
{
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/

View File

@ -0,0 +1,55 @@
// Paint application - Demonstate both TFT and Touch Screen
#include <stdint.h>
#include <SeeedTouchScreen.h>
#include <TFTv2.h>
#include <SPI.h>
int ColorPaletteHigh = 30;
int color = WHITE; //Paint brush color
unsigned int colors[8] = {BLACK, RED, GREEN, BLUE, CYAN, YELLOW, WHITE, GRAY1};
// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// The 2.8" TFT Touch shield has 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM); //init TouchScreen port pins
void setup()
{
Tft.TFTinit(); //init TFT library
Serial.begin(115200);
//Draw the pallet
for(int i = 0; i<8; i++)
{
Tft.fillRectangle(i*30, 0, 30, ColorPaletteHigh, colors[i]);
}
}
void loop()
{
// a point object holds x y and z coordinates.
Point p = ts.getPoint();
//map the ADC value read to into pixel co-ordinates
p.x = map(p.x, TS_MINX, TS_MAXX, 0, 240);
p.y = map(p.y, TS_MINY, TS_MAXY, 0, 320);
// we have some minimum pressure we consider 'valid'
// pressure of 0 means no pressing!
if (p.z > __PRESURE) {
// Detect paint brush color change
if(p.y < ColorPaletteHigh+2)
{
color = colors[p.x/30];
}
else
{
Tft.fillCircle(p.x,p.y,2,color);
}
}
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/

View File

@ -0,0 +1,23 @@
// Draw Boxes - Demonstrate drawRectangle and fillRectangle
#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>
void setup()
{
TFT_BL_ON; // turn on the background light
Tft.TFTinit(); // init TFT library
}
void loop()
{
for(int r=0;r<115;r=r+2) //set r : 0--115
{
Tft.drawCircle(119,160,r,random(0xFFFF)); //draw circle, center:(119, 160), color: random
}
delay(10);
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/

View File

@ -0,0 +1,35 @@
/* draw text's APP
drawChar(INT8U ascii,INT16U poX, INT16U poY,INT16U size, INT16U fgcolor);
drawString(char *string,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor);
*/
#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>
void setup()
{
TFT_BL_ON; // turn on the background light
Tft.TFTinit(); // init TFT library
Tft.drawChar('S',0,0,1,RED); // draw char: 'S', (0, 0), size: 1, color: RED
Tft.drawChar('E',10,10,2,BLUE); // draw char: 'E', (10, 10), size: 2, color: BLUE
Tft.drawChar('E',20,40,3,GREEN); // draw char: 'E', (20, 40), size: 3, color: GREEN
Tft.drawChar('E',30,80,4,YELLOW); // draw char: 'E', (30, 80), size: 4, color: YELLOW
Tft.drawChar('D',40,120,4,YELLOW); // draw char: 'D', (40, 120), size: 4, color: YELLOW
Tft.drawString("Hello",0,180,3,CYAN); // draw string: "hello", (0, 180), size: 3, color: CYAN
Tft.drawString("World!!",60,220,4,WHITE); // draw string: "world!!", (80, 230), size: 4, color: WHITE
}
void loop()
{
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

View File

@ -0,0 +1,235 @@
/*
TFT Touch Shield 2.0 examples - tftbmp
loovee
2013-1-21
this demo can show specified bmp file in root Directory of SD card
please ensure that your image file is 320x240 size.
change __Gnfile_num and __Gsbmp_files to display your image
*/
#include <SD.h>
#include <SPI.h>
#include <Streaming.h>
#include "TFTv2.h"
#define MAX_BMP 10 // bmp file num
#define FILENAME_LEN 20 // max file name length
const int PIN_SD_CS = 4; // pin of sd card
const int __Gnbmp_height = 320; // bmp hight
const int __Gnbmp_width = 240; // bmp width
unsigned char __Gnbmp_image_offset = 0; // offset
int __Gnfile_num = 3; // num of file
char __Gsbmp_files[3][FILENAME_LEN] = // add file name here
{
"flower.BMP",
"hibiscus.bmp",
"test.bmp",
};
File bmpFile;
void setup()
{
Serial.begin(9600);
pinMode(PIN_SD_CS,OUTPUT);
digitalWrite(PIN_SD_CS,HIGH);
Tft.TFTinit();
Sd2Card card;
card.init(SPI_FULL_SPEED, PIN_SD_CS);
if(!SD.begin(PIN_SD_CS))
{
Serial.println("failed!");
while(1); // init fail, die here
}
Serial.println("SD OK!");
TFT_BL_ON;
}
void loop()
{
for(unsigned char i=0; i<__Gnfile_num; i++)
{
bmpFile = SD.open(__Gsbmp_files[i]);
if (! bmpFile)
{
Serial.println("didnt find image");
while (1);
}
if(! bmpReadHeader(bmpFile))
{
Serial.println("bad bmp");
return;
}
bmpdraw(bmpFile, 0, 0);
bmpFile.close();
delay(1000);
}
}
/*********************************************/
// This procedure reads a bitmap and draws it to the screen
// its sped up by reading many pixels worth of data at a time
// instead of just one pixel at a time. increading the buffer takes
// more RAM but makes the drawing a little faster. 20 pixels' worth
// is probably a good place
#define BUFFPIXEL 60 // must be a divisor of 240
#define BUFFPIXEL_X3 180 // BUFFPIXELx3
void bmpdraw(File f, int x, int y)
{
bmpFile.seek(__Gnbmp_image_offset);
uint32_t time = millis();
uint8_t sdbuffer[BUFFPIXEL_X3]; // 3 * pixels to buffer
for (int i=0; i< __Gnbmp_height; i++)
{
for(int j=0; j<(240/BUFFPIXEL); j++)
{
bmpFile.read(sdbuffer, BUFFPIXEL_X3);
uint8_t buffidx = 0;
int offset_x = j*BUFFPIXEL;
unsigned int __color[BUFFPIXEL];
for(int k=0; k<BUFFPIXEL; k++)
{
__color[k] = sdbuffer[buffidx+2]>>3; // read
__color[k] = __color[k]<<6 | (sdbuffer[buffidx+1]>>2); // green
__color[k] = __color[k]<<5 | (sdbuffer[buffidx+0]>>3); // blue
buffidx += 3;
}
Tft.setCol(offset_x, offset_x+BUFFPIXEL);
Tft.setPage(i, i);
Tft.sendCMD(0x2c);
TFT_DC_HIGH;
TFT_CS_LOW;
for(int m=0; m < BUFFPIXEL; m++)
{
SPI.transfer(__color[m]>>8);
SPI.transfer(__color[m]);
}
TFT_CS_HIGH;
}
}
Serial.print(millis() - time, DEC);
Serial.println(" ms");
}
boolean bmpReadHeader(File f)
{
// read header
uint32_t tmp;
uint8_t bmpDepth;
if (read16(f) != 0x4D42) {
// magic bytes missing
return false;
}
// read file size
tmp = read32(f);
Serial.print("size 0x");
Serial.println(tmp, HEX);
// read and ignore creator bytes
read32(f);
__Gnbmp_image_offset = read32(f);
Serial.print("offset ");
Serial.println(__Gnbmp_image_offset, DEC);
// read DIB header
tmp = read32(f);
Serial.print("header size ");
Serial.println(tmp, DEC);
int bmp_width = read32(f);
int bmp_height = read32(f);
if(bmp_width != __Gnbmp_width || bmp_height != __Gnbmp_height) // if image is not 320x240, return false
{
return false;
}
if (read16(f) != 1)
return false;
bmpDepth = read16(f);
Serial.print("bitdepth ");
Serial.println(bmpDepth, DEC);
if (read32(f) != 0) {
// compression not supported!
return false;
}
Serial.print("compression ");
Serial.println(tmp, DEC);
return true;
}
/*********************************************/
// These read data from the SD card file and convert them to big endian
// (the data is stored in little endian format!)
// LITTLE ENDIAN!
uint16_t read16(File f)
{
uint16_t d;
uint8_t b;
b = f.read();
d = f.read();
d <<= 8;
d |= b;
return d;
}
// LITTLE ENDIAN!
uint32_t read32(File f)
{
uint32_t d;
uint16_t b;
b = read16(f);
d = read16(f);
d <<= 16;
d |= b;
return d;
}

View File

@ -0,0 +1,348 @@
/*
TFT Touch Shield 2.0 examples - tftbmp2
loovee
2013-1-21
this demo can show all bmp file in root Directory of SD card
please ensure that your image file is 320x240 size.
MAX_BMP can config the max file to display
FILENAME_LEN can config the max length of file name
*/
#include <SD.h>
#include <SPI.h>
#include <Streaming.h>
#include "TFTv2.h"
#define MAX_BMP 10 // bmp file num
#define FILENAME_LEN 20 // max file name length
const int PIN_SD_CS = 4; // pin of sd card
const long __Gnbmp_height = 320; // bmp hight
const long __Gnbmp_width = 240; // bmp width
long __Gnbmp_image_offset = 0;;
int __Gnfile_num = 0; // num of file
char __Gsbmp_files[MAX_BMP][FILENAME_LEN]; // file name
File bmpFile;
// if bmp file return 1, else return 0
bool checkBMP(char *_name, char r_name[])
{
int len = 0;
if(NULL == _name)return false;
while(*_name)
{
r_name[len++] = *(_name++);
if(len>FILENAME_LEN)return false;
}
r_name[len] = '\0';
if(len < 5)return false;
// if xxx.bmp or xxx.BMP
if( r_name[len-4] == '.' \
&& (r_name[len-3] == 'b' || (r_name[len-3] == 'B')) \
&& (r_name[len-2] == 'm' || (r_name[len-2] == 'M')) \
&& (r_name[len-1] == 'p' || (r_name[len-1] == 'P')) )
{
return true;
}
return false;
}
// search root to find bmp file
void searchDirectory()
{
File root = SD.open("/"); // root
while(true)
{
File entry = root.openNextFile();
if (! entry)
{
break;
}
if(!entry.isDirectory())
{
char *ptmp = entry.name();
char __Name[20];
if(checkBMP(ptmp, __Name))
{
Serial.println(__Name);
strcpy(__Gsbmp_files[__Gnfile_num++], __Name);
}
}
entry.close();
}
Serial.print("get ");
Serial.print(__Gnfile_num);
Serial.println(" file: ");
for(int i=0; i<__Gnfile_num; i++)
{
Serial.println(__Gsbmp_files[i]);
}
}
void setup()
{
Serial.begin(115200);
pinMode(PIN_SD_CS,OUTPUT);
digitalWrite(PIN_SD_CS,HIGH);
Tft.TFTinit();
Sd2Card card;
card.init(SPI_FULL_SPEED, PIN_SD_CS);
if(!SD.begin(PIN_SD_CS))
{
Serial.println("failed!");
while(1); // init fail, die here
}
Serial.println("SD OK!");
searchDirectory();
TFT_BL_ON;
}
void loop()
{
/*
static int dirCtrl = 0;
for(unsigned char i=0; i<__Gnfile_num; i++)
{
bmpFile = SD.open(__Gsbmp_files[i]);
if (! bmpFile)
{
Serial.println("didnt find image");
while (1);
}
if(! bmpReadHeader(bmpFile))
{
Serial.println("bad bmp");
return;
}
dirCtrl = 1-dirCtrl;
bmpdraw(bmpFile, 0, 0, dirCtrl);
bmpFile.close();
delay(1000);
}
*/
bmpFile = SD.open("pfvm_1.bmp");
if (! bmpFile)
{
Serial.println("didnt find image");
while (1);
}
if(! bmpReadHeader(bmpFile))
{
Serial.println("bad bmp");
return;
}
bmpdraw(bmpFile, 0, 0, 1);
bmpFile.close();
while(1);
}
/*********************************************/
// This procedure reads a bitmap and draws it to the screen
// its sped up by reading many pixels worth of data at a time
// instead of just one pixel at a time. increading the buffer takes
// more RAM but makes the drawing a little faster. 20 pixels' worth
// is probably a good place
#define BUFFPIXEL 60 // must be a divisor of 240
#define BUFFPIXEL_X3 180 // BUFFPIXELx3
#define UP_DOWN 1
#define DOWN_UP 0
// dir - 1: up to down
// dir - 2: down to up
void bmpdraw(File f, int x, int y, int dir)
{
if(bmpFile.seek(__Gnbmp_image_offset))
{
Serial.print("pos = ");
Serial.println(bmpFile.position());
}
uint32_t time = millis();
uint8_t sdbuffer[BUFFPIXEL_X3]; // 3 * pixels to buffer
for (int i=0; i< __Gnbmp_height; i++)
{
if(dir)
{
bmpFile.seek(__Gnbmp_image_offset+(__Gnbmp_height-1-i)*240*3);
}
for(int j=0; j<(240/BUFFPIXEL); j++)
{
bmpFile.read(sdbuffer, BUFFPIXEL_X3);
uint8_t buffidx = 0;
int offset_x = j*BUFFPIXEL;
unsigned int __color[BUFFPIXEL];
for(int k=0; k<BUFFPIXEL; k++)
{
__color[k] = sdbuffer[buffidx+2]>>3; // read
__color[k] = __color[k]<<6 | (sdbuffer[buffidx+1]>>2); // green
__color[k] = __color[k]<<5 | (sdbuffer[buffidx+0]>>3); // blue
buffidx += 3;
}
Tft.setCol(offset_x, offset_x+BUFFPIXEL);
if(dir)
{
Tft.setPage(i, i);
}
else
{
Tft.setPage(__Gnbmp_height-i-1, __Gnbmp_height-i-1);
}
Tft.sendCMD(0x2c);
TFT_DC_HIGH;
TFT_CS_LOW;
for(int m=0; m < BUFFPIXEL; m++)
{
SPI.transfer(__color[m]>>8);
SPI.transfer(__color[m]);
delay(10);
}
TFT_CS_HIGH;
}
}
Serial.print(millis() - time, DEC);
Serial.println(" ms");
}
boolean bmpReadHeader(File f)
{
// read header
uint32_t tmp;
uint8_t bmpDepth;
if (read16(f) != 0x4D42) {
// magic bytes missing
return false;
}
// read file size
tmp = read32(f);
Serial.print("size 0x");
Serial.println(tmp, HEX);
// read and ignore creator bytes
read32(f);
__Gnbmp_image_offset = read32(f);
Serial.print("offset ");
Serial.println(__Gnbmp_image_offset, DEC);
// read DIB header
tmp = read32(f);
Serial.print("header size ");
Serial.println(tmp, DEC);
int bmp_width = read32(f);
int bmp_height = read32(f);
if(bmp_width != __Gnbmp_width || bmp_height != __Gnbmp_height) // if image is not 320x240, return false
{
return false;
}
if (read16(f) != 1)
return false;
bmpDepth = read16(f);
Serial.print("bitdepth ");
Serial.println(bmpDepth, DEC);
if (read32(f) != 0) {
// compression not supported!
return false;
}
Serial.print("compression ");
Serial.println(tmp, DEC);
return true;
}
/*********************************************/
// These read data from the SD card file and convert them to big endian
// (the data is stored in little endian format!)
// LITTLE ENDIAN!
uint16_t read16(File f)
{
uint16_t d;
uint8_t b;
b = f.read();
d = f.read();
d <<= 8;
d |= b;
return d;
}
// LITTLE ENDIAN!
uint32_t read32(File f)
{
uint32_t d;
uint16_t b;
b = read16(f);
d = read16(f);
d <<= 16;
d |= b;
return d;
}

View File

@ -0,0 +1,107 @@
/*
2012 Copyright (c) Seeed Technology Inc.
*/
#include <pgmspace.h>
const unsigned char simpleFont[][8] PROGMEM=
{
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00},
{0x00,0x14,0x7F,0x14,0x7F,0x14,0x00,0x00},
{0x00,0x24,0x2A,0x7F,0x2A,0x12,0x00,0x00},
{0x00,0x23,0x13,0x08,0x64,0x62,0x00,0x00},
{0x00,0x36,0x49,0x55,0x22,0x50,0x00,0x00},
{0x00,0x00,0x05,0x03,0x00,0x00,0x00,0x00},
{0x00,0x1C,0x22,0x41,0x00,0x00,0x00,0x00},
{0x00,0x41,0x22,0x1C,0x00,0x00,0x00,0x00},
{0x00,0x08,0x2A,0x1C,0x2A,0x08,0x00,0x00},
{0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00},
{0x00,0xA0,0x60,0x00,0x00,0x00,0x00,0x00},
{0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00},
{0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00},
{0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00},
{0x00,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00},
{0x00,0x00,0x42,0x7F,0x40,0x00,0x00,0x00},
{0x00,0x62,0x51,0x49,0x49,0x46,0x00,0x00},
{0x00,0x22,0x41,0x49,0x49,0x36,0x00,0x00},
{0x00,0x18,0x14,0x12,0x7F,0x10,0x00,0x00},
{0x00,0x27,0x45,0x45,0x45,0x39,0x00,0x00},
{0x00,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00},
{0x00,0x01,0x71,0x09,0x05,0x03,0x00,0x00},
{0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00},
{0x00,0x06,0x49,0x49,0x29,0x1E,0x00,0x00},
{0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00},
{0x00,0x00,0xAC,0x6C,0x00,0x00,0x00,0x00},
{0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00},
{0x00,0x14,0x14,0x14,0x14,0x14,0x00,0x00},
{0x00,0x41,0x22,0x14,0x08,0x00,0x00,0x00},
{0x00,0x02,0x01,0x51,0x09,0x06,0x00,0x00},
{0x00,0x32,0x49,0x79,0x41,0x3E,0x00,0x00},
{0x00,0x7E,0x09,0x09,0x09,0x7E,0x00,0x00},
{0x00,0x7F,0x49,0x49,0x49,0x36,0x00,0x00},
{0x00,0x3E,0x41,0x41,0x41,0x22,0x00,0x00},
{0x00,0x7F,0x41,0x41,0x22,0x1C,0x00,0x00},
{0x00,0x7F,0x49,0x49,0x49,0x41,0x00,0x00},
{0x00,0x7F,0x09,0x09,0x09,0x01,0x00,0x00},
{0x00,0x3E,0x41,0x41,0x51,0x72,0x00,0x00},
{0x00,0x7F,0x08,0x08,0x08,0x7F,0x00,0x00},
{0x00,0x41,0x7F,0x41,0x00,0x00,0x00,0x00},
{0x00,0x20,0x40,0x41,0x3F,0x01,0x00,0x00},
{0x00,0x7F,0x08,0x14,0x22,0x41,0x00,0x00},
{0x00,0x7F,0x40,0x40,0x40,0x40,0x00,0x00},
{0x00,0x7F,0x02,0x0C,0x02,0x7F,0x00,0x00},
{0x00,0x7F,0x04,0x08,0x10,0x7F,0x00,0x00},
{0x00,0x3E,0x41,0x41,0x41,0x3E,0x00,0x00},
{0x00,0x7F,0x09,0x09,0x09,0x06,0x00,0x00},
{0x00,0x3E,0x41,0x51,0x21,0x5E,0x00,0x00},
{0x00,0x7F,0x09,0x19,0x29,0x46,0x00,0x00},
{0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00},
{0x00,0x01,0x01,0x7F,0x01,0x01,0x00,0x00},
{0x00,0x3F,0x40,0x40,0x40,0x3F,0x00,0x00},
{0x00,0x1F,0x20,0x40,0x20,0x1F,0x00,0x00},
{0x00,0x3F,0x40,0x38,0x40,0x3F,0x00,0x00},
{0x00,0x63,0x14,0x08,0x14,0x63,0x00,0x00},
{0x00,0x03,0x04,0x78,0x04,0x03,0x00,0x00},
{0x00,0x61,0x51,0x49,0x45,0x43,0x00,0x00},
{0x00,0x7F,0x41,0x41,0x00,0x00,0x00,0x00},
{0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00},
{0x00,0x41,0x41,0x7F,0x00,0x00,0x00,0x00},
{0x00,0x04,0x02,0x01,0x02,0x04,0x00,0x00},
{0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00},
{0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x00},
{0x00,0x20,0x54,0x54,0x54,0x78,0x00,0x00},
{0x00,0x7F,0x48,0x44,0x44,0x38,0x00,0x00},
{0x00,0x38,0x44,0x44,0x28,0x00,0x00,0x00},
{0x00,0x38,0x44,0x44,0x48,0x7F,0x00,0x00},
{0x00,0x38,0x54,0x54,0x54,0x18,0x00,0x00},
{0x00,0x08,0x7E,0x09,0x02,0x00,0x00,0x00},
{0x00,0x18,0xA4,0xA4,0xA4,0x7C,0x00,0x00},
{0x00,0x7F,0x08,0x04,0x04,0x78,0x00,0x00},
{0x00,0x00,0x7D,0x00,0x00,0x00,0x00,0x00},
{0x00,0x80,0x84,0x7D,0x00,0x00,0x00,0x00},
{0x00,0x7F,0x10,0x28,0x44,0x00,0x00,0x00},
{0x00,0x41,0x7F,0x40,0x00,0x00,0x00,0x00},
{0x00,0x7C,0x04,0x18,0x04,0x78,0x00,0x00},
{0x00,0x7C,0x08,0x04,0x7C,0x00,0x00,0x00},
{0x00,0x38,0x44,0x44,0x38,0x00,0x00,0x00},
{0x00,0xFC,0x24,0x24,0x18,0x00,0x00,0x00},
{0x00,0x18,0x24,0x24,0xFC,0x00,0x00,0x00},
{0x00,0x00,0x7C,0x08,0x04,0x00,0x00,0x00},
{0x00,0x48,0x54,0x54,0x24,0x00,0x00,0x00},
{0x00,0x04,0x7F,0x44,0x00,0x00,0x00,0x00},
{0x00,0x3C,0x40,0x40,0x7C,0x00,0x00,0x00},
{0x00,0x1C,0x20,0x40,0x20,0x1C,0x00,0x00},
{0x00,0x3C,0x40,0x30,0x40,0x3C,0x00,0x00},
{0x00,0x44,0x28,0x10,0x28,0x44,0x00,0x00},
{0x00,0x1C,0xA0,0xA0,0x7C,0x00,0x00,0x00},
{0x00,0x44,0x64,0x54,0x4C,0x44,0x00,0x00},
{0x00,0x08,0x36,0x41,0x00,0x00,0x00,0x00},
{0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00},
{0x00,0x41,0x36,0x08,0x00,0x00,0x00,0x00},
{0x00,0x02,0x01,0x01,0x02,0x01,0x00,0x00},
{0x00,0x02,0x05,0x05,0x02,0x00,0x00,0x00}
};

View File

@ -0,0 +1,61 @@
#######################################
# Syntax Coloring Map For SeeedTft2.0
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
Tft KEYWORD1
TFTv2 KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
TFTinit KEYWORD2
setCol KEYWORD2
setPage KEYWORD2
setXY KEYWORD2
setPixel KEYWORD2
sendCMD KEYWORD2
WRITE_Package KEYWORD2
WRITE_DATA KEYWORD2
sendData KEYWORD2
Read_Register KEYWORD2
fillScreen KEYWORD2
drawChar KEYWORD2
drawString KEYWORD2
fillRectangle KEYWORD2
drawLine KEYWORD2
drawVerticalLine KEYWORD2
drawHorizontalLine KEYWORD2
drawRectangle KEYWORD2
drawCircle KEYWORD2
fillCircle KEYWORD2
drawTraingle KEYWORD2
drawNumber KEYWORD2
drawFloat KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################
RED LITERAL1
GREEN LITERAL1
BLUE LITERAL1
BLACK LITERAL1
YELLOW LITERAL1
WHITE LITERAL1
CYAN LITERAL1
BRIGHT_RED LITERAL1
GRAY1 LITERAL1
GRAY2 LITERAL1
MIN_X LITERAL1
MIN_Y LITERAL1
MAX_X LITERAL1
MAX_Y LITERAL1
TFT_BL_ON LITERAL1
TFT_BL_OFF LITERAL1
TFT_CS_LOW LITERAL1
TFT_CS_HIGH LITERAL1
TFT_DC_LOW LITERAL1
TFT_DC_HIGH LITERAL1
RED LITERAL1
RED LITERAL1