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
main.h
00001 /** mbed oscilloscope my implementation of a oscillo scope 00002 * Copyright (c) 2014, 2015 Motoo Tanaka @ Design Methodology Lab 00003 * 00004 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00005 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00006 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00007 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00008 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00009 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00010 * THE SOFTWARE. 00011 */ 00012 #ifndef _MAIN_H_ 00013 #define _MAIN_H_ inluded 00014 00015 #if defined (TARGET_KL25Z) 00016 #define PIN_SCLK PTD1 00017 #define PIN_MISO PTD3 00018 #define PIN_MOSI PTD2 00019 #define PIN_CS_TFT PTD0 00020 #define PIN_DC_TFT PTD5 00021 #define PIN_CS_TSC PTA13 00022 #define PIN_BL_TFT PTC9 00023 #define PIN_CS_SD PTA4 00024 #define PIN_TSC_INTR PTC9 /* place holder */ 00025 #define PIN_RESET_TFT PTB10 /* place holder */ 00026 #define PIN_ADC_CH0 PTB0 00027 #define PIN_ADC_CH1 PTB2 00028 00029 #elif defined (TARGET_KL46Z) 00030 #define PIN_SCLK PTD5 00031 #define PIN_MISO PTD7 00032 #define PIN_MOSI PTD6 00033 #define PIN_CS_TFT PTD4 00034 #define PIN_DC_TFT PTD2 00035 #define PIN_CS_TSC PTA13 00036 #define PIN_BL_TFT PTC9 00037 #define PIN_CS_SD PTA4 00038 #define PIN_TSC_INTR PTC7 /* place holder */ 00039 #define PIN_RESET_TFT PTC6 /* place holder */ 00040 #define PIN_ADC_CH0 PTB0 00041 #define PIN_ADC_CH1 PTB2 00042 00043 #elif defined (TARGET_K64F) 00044 #define PIN_SCLK PTD1 00045 #define PIN_MISO PTD3 00046 #define PIN_MOSI PTD2 00047 #define PIN_CS_TFT PTD0 00048 #define PIN_DC_TFT PTC4 00049 // for board rev E or later 00050 #define PIN_CS_TSC PTC12 00051 // for earlier boards use following line 00052 // #define PIN_CS_TSC PTA0 00053 #define PIN_BL_TFT PTC3 00054 #define PIN_CS_SD PTB23 00055 #define PIN_TSC_INTR PTC0 /* place holder */ 00056 #define PIN_RESET_TFT PTC9 /* place holder */ 00057 #define PIN_ADC_CH0 PTB2 00058 #define PIN_ADC_CH1 PTB10 00059 00060 #elif defined (TARGET_K22F) 00061 #define PIN_SCLK PTD5 00062 #define PIN_MISO PTD7 00063 #define PIN_MOSI PTD6 00064 #define PIN_CS_TFT PTD4 00065 #define PIN_DC_TFT PTA1 00066 #define PIN_CS_TSC PTB19 00067 #define PIN_BL_TFT PTC6 00068 #define PIN_CS_SD PTA4 00069 #define PIN_TSC_INTR PTC7 /* place holder */ 00070 #define PIN_RESET_TFT PTC9 /* place holder */ 00071 #define PIN_ADC_CH0 PTB0 00072 #define PIN_ADC_CH1 PTC1 00073 00074 #elif defined (TARGET_NUCLEO_F411RE) 00075 #define PIN_SCLK PA_5 00076 #define PIN_MISO PA_6 00077 #define PIN_MOSI PA_7 00078 #define PIN_CS_TFT PB_6 00079 #define PIN_DC_TFT PC_7 00080 #define PIN_CS_TSC PA_9 00081 #define PIN_BL_TFT PA_8 00082 #define PIN_CS_SD PB_5 00083 #define PIN_TSC_INTR PA_8 /* place holder */ 00084 #define PIN_RESET_TFT PA_13 /* place holder */ 00085 #define PIN_ADC_CH0 PA_0 00086 #define PIN_ADC_CH1 PA_4 00087 00088 #elif defined (TARGET_K20D50M) 00089 #define PIN_SCLK PTD1 00090 #define PIN_MISO PTD3 00091 #define PIN_MOSI PTD2 00092 #define PIN_CS_TFT PTC2 00093 #define PIN_DC_TFT PTA2 00094 #define PIN_CS_TSC PTA12 00095 #define PIN_BL_TFT PTC4 00096 #define PIN_CS_SD PTC8 00097 #define PIN_TSC_INTR PTA4 /* place holder */ 00098 #define PIN_RESET_TFT PTC7 /* place holder */ 00099 #define PIN_ADC_CH0 PTC0 00100 #define PIN_ADC_CH1 PTD6 00101 00102 #elif defined (TARGET_MAX32600MBED) 00103 /* I2C */ 00104 #define PIN_SCL P2_7 00105 #define PIN_SDA P2_6 00106 /* SPI */ 00107 #define PIN_SCLK P2_0 00108 #define PIN_MISO P2_2 00109 #define PIN_MOSI P2_1 00110 #define PIN_CS0 P2_3 00111 /* Interrupt */ 00112 #define PIN_INT0 P2_4 00113 #define PIN_INT1 P2_5 00114 #define PIN_INT2 P1_7 00115 #define PIN_INT3 P1_6 00116 #define PIN_INT4 P1_5 00117 #define PIN_INT5 P1_4 00118 /* Analog In */ 00119 #define PIN_AN0 AIN_0P 00120 #define PIN_AN1 AIN_1P 00121 #define PIN_AN2 AIN_2P 00122 #define PIN_AN3 AIN_3P 00123 #define PIN_AN4 AIN_4P 00124 #define PIN_AN5 AIN_5P 00125 #define BOARD_NAME "MAX32600MBED" 00126 00127 #define PIN_CS_TFT P2_3 // D10 PTD0 00128 #define PIN_DC_TFT P2_4 // D9 PTD5 00129 #define PIN_CS_TSC P2_5 // D8 PTA13 00130 #define PIN_BL_TFT P1_7 // D7 PTC9 00131 #define PIN_CS_SD P1_4 // D4 PTA4 00132 #define PIN_TSC_INTR P5_4 // PTC9 /* place holder */ 00133 #define PIN_RESET_TFT P5_5 /// PTB10 /* place holder */ 00134 #define PIN_ADC_CH0 AIN_0P // A0 PTB0 00135 #define PIN_ADC_CH1 AIN_2P // A2 PTB2 00136 #else 00137 #error TARGET NOT DEFINED 00138 #define PIN_SCLK D13 00139 #define PIN_MISO D12 00140 #define PIN_MOSI D11 00141 #define PIN_CS_TFT D10 00142 #define PIN_DC_TFT D9 00143 #define PIN_CS_TSC D8 00144 #define PIN_BL_TFT D7 00145 #define PIN_CS_SD D4 00146 #define PIN_TSC_INTR D5-inside /* place holder */ 00147 #define PIN_RESET_TFT D4-inside /* place holder */ 00148 #define PIN_ADC_CH0 A0 00149 #define PIN_ADC_CH1 A2 00150 00151 #endif 00152 00153 #define CHART_LEN 198 00154 00155 // NOTE: in case MIN_INTERVAL is too small 00156 // the program hangs during ADC and timer interrupt 00157 #define MIN_INTERVAL 30 00158 #define MAX_INTERVAL 20000 00159 #define NUM_MAX_MENU 20 00160 #define NUM_MAX_ANALOG_CH 2 00161 #define MODE_RUN 1 00162 #define MODE_STOP 0 00163 00164 #define opPlus 0 00165 #define opMinus 1 00166 #define opMul 2 00167 #define opDiv 3 00168 00169 00170 extern vt100 tty ; 00171 extern AnalogIn *ach[] ; 00172 extern Ticker timer ; 00173 00174 extern DigitalOut backlight ; 00175 extern ILI9341 TFT ; 00176 extern SPI_STMPE610 TSC ; 00177 extern TFTMenuItem *menu[] ; 00178 extern int numMenu ; 00179 00180 extern int num_digit ; 00181 extern long prevValue ; 00182 extern long topValue ; 00183 extern int op ; 00184 00185 void display(char *label = 0) ; 00186 #endif /* _MAIN_H_ */
Generated on Thu Jul 14 2022 06:26:05 by
1.7.2