Library for SeeedStudioTFTv2 2.8 Zoll 240x360 pixel touch SD card
Dependents: SeeedStudioTFTv2_HelloWorld SeeedTouchLCD Seeed_TFT_Touch_Shield_v2_HelloWorld
Fork of SeeedStudioTFTv2 by
Revision 3:1e05b273008a, committed 2013-10-18
- Comitter:
- mazgch
- Date:
- Fri Oct 18 18:29:09 2013 +0000
- Parent:
- 2:ef7972c29c0e
- Child:
- 4:4542d1ff81e4
- Commit message:
- fork
Changed in this revision
touch_tft.cpp | Show annotated file Show diff for this revision Revisions of this file |
touch_tft.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/touch_tft.cpp Sun Sep 04 21:23:31 2011 +0000 +++ b/touch_tft.cpp Fri Oct 18 18:29:09 2013 +0000 @@ -19,9 +19,9 @@ #define threshold 0x2000 // threshold to detect pressed touch_tft::touch_tft(PinName xp, PinName xm, PinName yp, PinName ym, - PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset,const char* name): + PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset,PinName dc,const char* name): _xp(xp),_xm(xm),_yp(yp),_ym(ym),_ax(xp),_ay(yp), - SPI_TFT(mosi,miso,sclk,cs,reset,name) { + SPI_TFT_ILI9341(mosi,miso,sclk,cs,reset,dc,name) { xa = xp; ya = yp; @@ -59,8 +59,8 @@ } y2 = y1; // debug - //locate(1,7); - //printf("d: %4d y: %5d s1: %4d",d1,y1,s1); + /**/locate(1,7); + /**/this->printf("d: %4d y: %5d s1: %4d",d1,y1,s1); // read x voltage _yp.output(); @@ -88,8 +88,8 @@ } x2 = x1; // debug - //locate(1,8); - //printf("d: %4d x: %5d s2: %4d",d2,x1,s2); + /**/locate(1,8); + /**/this->printf("d: %4d x: %5d s2: %4d",d2,x1,s2); } while (s1 < 3 || s2 < 3); // read until we have three samples close together switch (orientation) { @@ -114,6 +114,7 @@ point p; cls(); + foreground(White); // set chars to white line(0,3,6,3,White); line(3,0,3,6,White); @@ -124,9 +125,9 @@ pos_y = pos_y * font[2]; locate(pos_x,pos_y); - printf("press cross"); + this->printf("press cross"); locate(pos_x,pos_y + font[2]); - printf("to calibrate"); + this->printf("to calibrate"); for (i=0; i<5; i++) { do { p = get_touch(); @@ -137,7 +138,7 @@ a = a / 5; b = b / 5; locate(pos_x,pos_y); - printf("OK "); + this->printf("OK "); do { p = get_touch(); } while (p.y > 0x2000 | p.x > 0x2000); // wait for no touch @@ -146,9 +147,9 @@ line(width() -5, height() - 8,width() - 5,height() -1,White); // paint cross line(width() - 8,height() - 5,width() - 1,height() - 5,White); locate(pos_x,pos_y); - printf("press cross"); + this->printf("press cross"); locate(pos_x,pos_y + font[2]); - printf("to calibrate"); + this->printf("to calibrate"); for (i=0; i<5; i++) { do { p = get_touch(); @@ -160,7 +161,7 @@ d = d / 5; locate(pos_x, pos_y); - printf("OK "); + this->printf("OK "); do { p = get_touch(); } while (p.y > 0x2000 | p.x > 0x2000); // wait for no touch
--- a/touch_tft.h Sun Sep 04 21:23:31 2011 +0000 +++ b/touch_tft.h Fri Oct 18 18:29:09 2013 +0000 @@ -15,7 +15,7 @@ #define MBED_TOUCH_H #include "mbed.h" -#include "SPI_TFT.h" +#include "SPI_TFT_ILI9341.h" struct point{ unsigned short x; @@ -36,7 +36,7 @@ * // the TFT is connected to SPI pin 5-7 * // the touch is connected to 19,20,16,17 * - * touch_tft tt(p19,p20,p16,p17,p5, p6, p7, p8, p15,"TFT"); // x+,x-,y+,y-,mosi, miso, sclk, cs, reset + * touch_tft tt(p19,p20,p16,p17, &tft); // x+,x-,y+,y-,mosi, miso, sclk, cs, reset * * int main() { * point p; @@ -58,7 +58,7 @@ * } * @endcode */ -class touch_tft : public SPI_TFT{ +class touch_tft : public SPI_TFT_ILI9341 { public: /** create a TFT with touch object connected to the pins: * @@ -71,7 +71,7 @@ * @param reset pin connected to RESET of display * based on my SPI_TFT lib */ - touch_tft(PinName xp, PinName xm, PinName yp, PinName ym,PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset,const char* name ="TFT"); + touch_tft(PinName xp, PinName xm, PinName yp, PinName ym,PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset, PinName dc, const char* name ="TFT"); /** calibrate the touch display *