Demo program for Adafruit TFT 2.8" TFT resistive touch Shield - TFT screen library from SeeedStudio - touch screen library from Motoo Tanaka - pinout for Nucleo-F103RB

Dependencies:   SPI_STMPE610 SeeedStudioTFTv2 TFT_fonts mbed

Fork of Seeed_TFT_Touch_Shield by Shields

Files at this revision

API Documentation at this revision

Comitter:
hcseran
Date:
Fri Apr 03 07:13:35 2015 +0000
Parent:
4:e98910e480b4
Commit message:
Demo program for Adafruit 2.8" TFT touch screen with Nucleo-F103RB

Changed in this revision

SPI_STMPE610.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r e98910e480b4 -r 2682b8d7e871 SPI_STMPE610.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SPI_STMPE610.lib	Fri Apr 03 07:13:35 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Rhyme/code/SPI_STMPE610/#988661c63061
diff -r e98910e480b4 -r 2682b8d7e871 main.cpp
--- a/main.cpp	Fri Feb 13 09:39:48 2015 +0000
+++ b/main.cpp	Fri Apr 03 07:13:35 2015 +0000
@@ -26,6 +26,7 @@
 #include "Arial24x23.h"
 #include "Arial28x28.h"
 #include "font_big.h"
+#include "SPI_STMPE610.h"
 
 #define PIN_XP          A3
 #define PIN_XM          A1
@@ -34,12 +35,16 @@
 #define PIN_MOSI        D11
 #define PIN_MISO        D12
 #define PIN_SCLK        D13
-#define PIN_CS_TFT      D5
-#define PIN_DC_TFT      D6
+//#define PIN_CS_TFT      D5    // for SEED
+#define PIN_CS_TFT      D10    // for adafruit
+//#define PIN_DC_TFT      D6      // for SEED
+#define PIN_DC_TFT      D9      // for adafruit
 #define PIN_BL_TFT      D7
 #define PIN_CS_SD       D4
+#define PIN_CS_TSC      D8
 
 SeeedStudioTFTv2 TFT(PIN_XP, PIN_XM, PIN_YP, PIN_YM, PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TFT, PIN_DC_TFT, PIN_BL_TFT, PIN_CS_SD);
+SPI_STMPE610 TSC(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ;
 
 int main()
 {
@@ -90,11 +95,24 @@
     TFT.printf("Different Fonts:");
     TFT.set_font((unsigned char*) Neu42x35);
     TFT.locate(0,30);
-    TFT.printf("Hello Mbed 1");
+    TFT.printf("Hello Henry");
     TFT.set_font((unsigned char*) Arial24x23);
     TFT.locate(20,80);
-    TFT.printf("Hello Mbed 2");
+    TFT.printf("Hello Henry");
     TFT.set_font((unsigned char*) Arial12x12);
     TFT.locate(35,120);
-    TFT.printf("Hello Mbed 3");
+    TFT.printf("Hello Henry");
+    wait(3.0);
+    
+    uint16_t touched, x, y, z ;
+    TFT.printf("Test SPI STMPE610\n\r") ;
+    while (true) {
+       touched = TSC.getRAWPoint(&x, &y, &z) ;
+       if (touched) {
+           TFT.cls();
+           TFT.locate(0,150);
+           TFT.printf("x = %d\n\r y = %d\n\r z = %d\n\r", x, y, z) ;
+       }
+       wait(0.1) ;
+   }
 }