Simple integer calculator using FRDM-KL25Z and Adafruit 2.8" TFT with touch \\ "Dentaku" means "Desktop Calculator" in Japanese \\ On 5-Dec-2015, Support for FRDM-K64F, FRDM-K22F, NUCLEO-F411RE added.

Dependencies:   SPI_STMPE610 UniGraphic mbed vt100

Yet another simple desktop calculator program, only for integer.
As usual I used FRDM-KL25Z, Adafruit 2.8" TFT with touch and UniGraphic library.
Now works with FRDM-K64F, FRDM-K22F, and NUCLEO-F411RE.

整数計算のみの簡単な電卓プログラムです。
例によって、FRDM-KL25Z, Adafruit 2.8" TFT with touch, そして UniGraphic を使用しています。
FRDM-K64F, FRDM-K22F, NUCLEO-F411RE でも動くようになりました。

/media/uploads/Rhyme/img_1194.jpg

Files at this revision

API Documentation at this revision

Comitter:
Rhyme
Date:
Sat Dec 05 10:24:21 2015 +0000
Parent:
1:1d311dfd5f5c
Child:
3:998ba6618f38
Commit message:
Support for FRDM-K64F, FRDM-K22F, NECLEO-F411RE added.

Changed in this revision

SPI_STMPE610.lib Show annotated file Show diff for this revision Revisions of this file
UniGraphic.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
main.h Show annotated file Show diff for this revision Revisions of this file
--- a/SPI_STMPE610.lib	Sun Aug 02 14:03:06 2015 +0000
+++ b/SPI_STMPE610.lib	Sat Dec 05 10:24:21 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Rhyme/code/SPI_STMPE610/#34e7dc5991b5
+http://mbed.org/users/Rhyme/code/SPI_STMPE610/#09fece599665
--- a/UniGraphic.lib	Sun Aug 02 14:03:06 2015 +0000
+++ b/UniGraphic.lib	Sat Dec 05 10:24:21 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/GraphicsDisplay/code/UniGraphic/#f9a37f22b9cb
+http://mbed.org/teams/GraphicsDisplay/code/UniGraphic/#87855d03d91a
--- a/main.cpp	Sun Aug 02 14:03:06 2015 +0000
+++ b/main.cpp	Sat Dec 05 10:24:21 2015 +0000
@@ -105,6 +105,6 @@
         if ((x != 0)||(y !=0)) { // FRDM-KL46Z fails to return touched somehow
             result = doMenu(x, y) ;
         }
-        wait(0.1) ;
+        wait(0.01) ;
     }
 }
--- a/main.h	Sun Aug 02 14:03:06 2015 +0000
+++ b/main.h	Sat Dec 05 10:24:21 2015 +0000
@@ -12,57 +12,108 @@
 #ifndef _MAIN_H_
 #define _MAIN_H_ inluded
 
-// uncomment following line if K64F rev is E or later
-#define FRDM_K64F_VE
-
-#if   defined (TARGET_KL25Z) 
+#if defined (TARGET_KL25Z) 
+#define PIN_SCLK        PTD1
+#define PIN_MISO        PTD3 
 #define PIN_MOSI        PTD2
-#define PIN_MISO        PTD3 
-#define PIN_SCLK        PTD1 
 #define PIN_CS_TFT      PTD0 
 #define PIN_DC_TFT      PTD5 
+#define PIN_CS_TSC      PTA13
 #define PIN_BL_TFT      PTC9 
 #define PIN_CS_SD       PTA4 
-#define PIN_CS_TSC      PTA13
-#define PIN_TSC_INTR    PTC9
-#define PIN_RESET_TFT   PTB10
+#define PIN_TSC_INTR    PTC9 /* place holder */
+#define PIN_RESET_TFT   PTB10 /* place holder */
 #define PIN_ADC_CH0     PTB0
-#define PIN_ADC_CH1     PTB1
+#define PIN_ADC_CH1     PTB2
 
 #elif defined (TARGET_KL46Z)
-#define PIN_MOSI        PTD6
+#define PIN_SCLK        PTD5 
 #define PIN_MISO        PTD7 
-#define PIN_SCLK        PTD5 
+#define PIN_MOSI        PTD6
 #define PIN_CS_TFT      PTD4 
 #define PIN_DC_TFT      PTD2 
+#define PIN_CS_TSC      PTA13
 #define PIN_BL_TFT      PTC9 
 #define PIN_CS_SD       PTA4 
-#define PIN_CS_TSC      PTA13
-#define PIN_TSC_INTR    PTC9
-#define PIN_RESET_TFT   PTA20
+#define PIN_TSC_INTR    PTC7 /* place holder */
+#define PIN_RESET_TFT   PTC6 /* place holder */
 #define PIN_ADC_CH0     PTB0
-#define PIN_ADC_CH1     PTB1
+#define PIN_ADC_CH1     PTB2
 
 #elif defined (TARGET_K64F)
-#define PIN_MOSI        PTD2
+#define PIN_SCLK        PTD1
 #define PIN_MISO        PTD3
-#define PIN_SCLK        PTD1
+#define PIN_MOSI        PTD2
 #define PIN_CS_TFT      PTD0
 #define PIN_DC_TFT      PTC4
+// for board rev E or later
+#define PIN_CS_TSC      PTC12
+// for earlier boards use following line
+// #define PIN_CS_TSC      PTA0
 #define PIN_BL_TFT      PTC3
 #define PIN_CS_SD       PTB23
-#ifdef FRDM_K64F_VE
-#define PIN_CS_TSC      PTC12
-#else
-#define PIN_CS_TSC      PTA0
-#endif
-#define PIN_TSC_INTR    PTC3
-#define PIN_RESET_TFT   PTB20
+#define PIN_TSC_INTR    PTC0 /* place holder */
+#define PIN_RESET_TFT   PTC9 /* place holder */
 #define PIN_ADC_CH0     PTB2
-#define PIN_ADC_CH1     PTB3
+#define PIN_ADC_CH1     PTB10
+
+#elif defined (TARGET_K22F)
+#define PIN_SCLK        PTD5
+#define PIN_MISO        PTD7
+#define PIN_MOSI        PTD6
+#define PIN_CS_TFT      PTD4
+#define PIN_DC_TFT      PTA1
+#define PIN_CS_TSC      PTB19
+#define PIN_BL_TFT      PTC6 
+#define PIN_CS_SD       PTA4 
+#define PIN_TSC_INTR    PTC7 /* place holder */
+#define PIN_RESET_TFT   PTC9 /* place holder */
+#define PIN_ADC_CH0     PTB0
+#define PIN_ADC_CH1     PTC1
+
+#elif defined (TARGET_NUCLEO_F411RE)
+#define PIN_SCLK        PA_5
+#define PIN_MISO        PA_6
+#define PIN_MOSI        PA_7
+#define PIN_CS_TFT      PB_6
+#define PIN_DC_TFT      PC_7
+#define PIN_CS_TSC      PA_9
+#define PIN_BL_TFT      PA_8
+#define PIN_CS_SD       PB_5
+#define PIN_TSC_INTR    PA_8 /* place holder */
+#define PIN_RESET_TFT   PA_13 /* place holder */
+#define PIN_ADC_CH0     PA_0
+#define PIN_ADC_CH1     PA_4
+
+#elif defined (TARGET_K20D50M)
+#define PIN_SCLK        PTD1
+#define PIN_MISO        PTD3
+#define PIN_MOSI        PTD2
+#define PIN_CS_TFT      PTC2
+#define PIN_DC_TFT      PTA2 
+#define PIN_CS_TSC      PTA12
+#define PIN_BL_TFT      PTC4 
+#define PIN_CS_SD       PTC8 
+#define PIN_TSC_INTR    PTA4 /* place holder */
+#define PIN_RESET_TFT   PTC7 /* place holder */
+#define PIN_ADC_CH0     PTC0
+#define PIN_ADC_CH1     PTD6
 
 #else
-  #error TARGET NOT DEFINED
+ #error TARGET NOT DEFINED
+#define PIN_SCLK        D13 
+#define PIN_MISO        D12 
+#define PIN_MOSI        D11
+#define PIN_CS_TFT      D10 
+#define PIN_DC_TFT      D9 
+#define PIN_CS_TSC      D8
+#define PIN_BL_TFT      D7 
+#define PIN_CS_SD       D4 
+#define PIN_TSC_INTR    D5-inside /* place holder */
+#define PIN_RESET_TFT   D4-inside /* place holder */
+#define PIN_ADC_CH0     A0
+#define PIN_ADC_CH1     A2
+
 #endif
 
 #define CHART_LEN    198