Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SeeedStudioTFTv2 by
Diff: touch_tft.cpp
- Revision:
- 3:1e05b273008a
- Parent:
- 2:ef7972c29c0e
--- 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
