test program for SPI_STMPE610
Dependencies: SPI_STMPE610 mbed vt100
Revision 1:8e4295a5c716, committed 2015-08-02
- Comitter:
- Rhyme
- Date:
- Sun Aug 02 13:48:46 2015 +0000
- Parent:
- 0:bfe34cc0bc72
- Child:
- 2:0ed1195754b0
- Commit message:
- SPI_STMPE610 updated;
Changed in this revision
--- a/SPI_STMPE610.lib Sat Nov 08 07:13:38 2014 +0000 +++ b/SPI_STMPE610.lib Sun Aug 02 13:48:46 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/Rhyme/code/SPI_STMPE610/#ee910b63c077 +http://developer.mbed.org/users/Rhyme/code/SPI_STMPE610/#9bec97573139
--- a/main.cpp Sat Nov 08 07:13:38 2014 +0000
+++ b/main.cpp Sun Aug 02 13:48:46 2015 +0000
@@ -16,21 +16,84 @@
#include "mbed.h"
#include "SPI_STMPE610.h"
+#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
-SPI_STMPE610 TSC(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ;
+#if defined (TARGET_KL25Z)
+#define PIN_MOSI PTD2
+#define PIN_MISO PTD3
+#define PIN_SCLK PTD1
+#define PIN_CS_TFT PTD0
+#define PIN_DC_TFT PTD5
+#define PIN_BL_TFT PTC9
+#define PIN_CS_SD PTA4
+#define PIN_CS_TSC PTA13
+#define PIN_TSC_INTR PTC9
+#define DEVICE_NAME "KL25Z"
+
+#elif defined (TARGET_KL46Z)
+#define PIN_MOSI PTD6
+#define PIN_MISO PTD7
+#define PIN_SCLK PTD5
+#define PIN_CS_TFT PTD4
+#define PIN_DC_TFT PTD2
+#define PIN_BL_TFT PTC9
+#define PIN_CS_SD PTA4
+#define PIN_CS_TSC PTA13
+#define PIN_TSC_INTR PTC9
+#define DEVICE_NAME "KL46Z"
+
+#elif defined (TARGET_K64F)
+#define PIN_MOSI PTD2
+#define PIN_MISO PTD3
+#define PIN_SCLK PTD1
+#define PIN_CS_TFT PTD0
+#define PIN_DC_TFT PTC4
+#define PIN_BL_TFT PTC3
+#define PIN_CS_SD PTB23
+#define PIN_CS_TSC PTA0
+#define PIN_TSC_INTR PTC3
+#define PIN_RESET_TFT PTB20
+#define PIN_ADC_CH0 PTB2
+#define PIN_ADC_CH1 PTB3
+#define DEVICE_NAME "K64F"
+
+#else
+ #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 tsc_intr(PIN_TSC_INTR) ; // should be input, just for test
int main()
{
uint16_t touched, x, y, z ;
- printf("Test SPI STMPE610\n\r") ;
+ SPI_STMPE610 *tsc ;
+ tsc = new SPI_STMPE610(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ;
+ printf("Test SPI STMPE610 (%s:%s)\n\r", DEVICE_NAME, __DATE__) ;
+ tft_cs = 1 ;
+ sd_cs = 1 ;
+// tsc_intr = 1 ;
+ tsc_cs = 0 ;
while (true) {
- touched = TSC.getRAWPoint(&x, &y, &z) ;
- if (touched) {
+// 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 ;
+ */
printf("x = %d, y = %d, z = %d\n\r", x, y, z) ;
}
wait(0.1) ;
--- a/mbed.bld Sat Nov 08 07:13:38 2014 +0000 +++ b/mbed.bld Sun Aug 02 13:48:46 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92 \ No newline at end of file