aivan upea mahtava piirto-ohjelma
Dependencies: SPI_TFT_ILI9341 TFT_fonts mbed touch
Fork of touch by
Diff: main.cpp
- Revision:
- 2:9d80fd43a008
- Parent:
- 1:d03155bfc252
- Child:
- 3:30b085fb4f1a
diff -r d03155bfc252 -r 9d80fd43a008 main.cpp --- a/main.cpp Thu Jul 14 22:49:04 2011 +0000 +++ b/main.cpp Sun Sep 04 21:49:22 2011 +0000 @@ -8,7 +8,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,p11, p12, p13, p14, p15,"TFT"); // x+,x-,y+,y-,mosi, miso, sclk, cs, reset int main() { @@ -26,7 +26,7 @@ tt.calibrate(); // calibrate the touch tt.locate(0,0); printf(" x = "); - tt.locate(0,1); + tt.locate(0,12); printf(" y = "); tt.line(0,25,319,25,White); // the color chosing fields @@ -44,6 +44,7 @@ p = tt.get_touch(); if (tt.is_touched(p)) { // touch + p = tt.to_pixel(p); // convert to pixel pos if (p.y < 26) { // a button field if (p.x > 80 && p.x < 100) { // White @@ -79,13 +80,12 @@ if (p.x > 300) { tt.fillrect(0,26,319,239,Black); } - - + } else { tt.fillcircle(p.x,p.y,brush,color); - tt.locate(3,0); + tt.locate(36,0); printf("%3d",p.x); - tt.locate(3,1); + tt.locate(36,12); printf("%3d",p.y); } }