test program for SPI_STMPE610

Dependencies:   SPI_STMPE610 mbed vt100

Files at this revision

API Documentation at this revision

Comitter:
Rhyme
Date:
Mon May 01 00:33:06 2017 +0000
Parent:
2:0ed1195754b0
Commit message:
Some clean-ups applied

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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
vt100.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 0ed1195754b0 -r 547b48007148 SPI_STMPE610.lib
--- a/SPI_STMPE610.lib	Mon Mar 13 00:49:23 2017 +0000
+++ b/SPI_STMPE610.lib	Mon May 01 00:33:06 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Rhyme/code/SPI_STMPE610/#09fece599665
+http://mbed.org/users/Rhyme/code/SPI_STMPE610/#6740dfc84a8c
diff -r 0ed1195754b0 -r 547b48007148 main.cpp
--- a/main.cpp	Mon Mar 13 00:49:23 2017 +0000
+++ b/main.cpp	Mon May 01 00:33:06 2017 +0000
@@ -14,21 +14,10 @@
   * to an interrupt pin on my frdm-kl25z, I just used polling mode.
   */
 #include "mbed.h"
+#include "vt100.h"
 #include "SPI_STMPE610.h"
 
-#if 0
-#ifndef TARGET_NECLEO_F411RE
-#define TARGET_NECLEO_F411RE 
-#endif
-#endif 
-
-#if 0
-#define PIN_MOSI        PTD2
-#define PIN_MISO        PTD3 
-#define PIN_SCLK        PTD1 
-#define PIN_CS_TSC      PTA13
-#define PIN_TSC_INTR    PTC9
-#endif
+vt100 *tty = 0 ;
 
 #if   defined (TARGET_KL25Z) 
 #define PIN_MOSI        PTD2
@@ -90,6 +79,8 @@
 #define PIN_SCLK  P2_0
 #define PIN_MISO P2_2
 #define PIN_MOSI P2_1
+// #define PIN_MISO P2_1
+// #define PIN_MOSI P2_2
 #define PIN_CS0  P2_3
 /* Interrupt */
 #define PIN_INT0 P2_4
@@ -122,34 +113,35 @@
   #error TARGET NOT DEFINED
 #endif
 
-// SPI_STMPE610 TSC(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ;
-
-DigitalOut tft_cs(PIN_CS_TFT) ;
-DigitalOut sd_cs(PIN_CS_SD) ;
-DigitalOut tsc_cs(PIN_CS_TSC) ;
+DigitalOut tft_cs(PIN_CS_TFT, 1) ;
+DigitalOut sd_cs(PIN_CS_SD, 1) ;
+DigitalOut tsc_cs(PIN_CS_TSC, 1) ;
 // DigitalOut tsc_intr(PIN_TSC_INTR) ; // should be input, just for test
+// DigitalOut tft_reset(PIN_RESET_TFT, 1) ;
 
 int main()
 {
     uint16_t touched, x, y, z ;
     SPI_STMPE610 *tsc ;
+#if (TARGET_MAX32600MBED)
+    uint32_t *SPI0_MSTR_CFG = (uint32_t*)0x40030000 ;
+    tty = new vt100(57600) ;
+#else
+    tty = new vt100() ;
+#endif
+    tty->cls() ;
+    
     tsc = new SPI_STMPE610(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ;
-//    tsc->spi_format(8, 1) ;
+ //   tsc->spi_frequency(1000000) ; 
+ //   tsc->spi_format(8, 0) ;
     printf("Test SPI STMPE610 (%s:%s)\n\r", DEVICE_NAME, __DATE__) ;
-    tft_cs = 1 ;
-    sd_cs = 1 ;
-//    tsc_intr = 1 ;
-    tsc_cs = 0 ;
+
+    tft_cs = 1 ; /* disable TFT display */
+    sd_cs = 1 ; /* disable SD */
+
     while (true) {
-//        touched = TSC.getRAWPoint(&x, &y, &z) ;
         touched = tsc->getRAWPoint(&x, &y, &z) ;
-//        if (touched) {
-        if (!((x==0)&&(y==0)&&(z==0))) {
-            /*
-            x &= 0x7FFF ;
-            y &= 0x7FFF ;
-            z &= 0x7FFF ;
-            */
+        if (touched) {
             printf("x = %d, y = %d, z = %d\n\r", x, y, z) ;
         }
         wait(0.1) ;
diff -r 0ed1195754b0 -r 547b48007148 mbed.bld
--- a/mbed.bld	Mon Mar 13 00:49:23 2017 +0000
+++ b/mbed.bld	Mon May 01 00:33:06 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e1686b8d5b90
\ No newline at end of file
+https://mbed.org/users/mbed_official/code/mbed/builds/093f2bd7b9eb
\ No newline at end of file
diff -r 0ed1195754b0 -r 547b48007148 vt100.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vt100.lib	Mon May 01 00:33:06 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/Rhyme/code/vt100/#b7229a9eae1c