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 でも動くようになりました。
Diff: main.h
- Revision:
- 0:659a74b77279
- Child:
- 2:ddf8d8fffb4f
diff -r 000000000000 -r 659a74b77279 main.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.h Sun Aug 02 14:00:59 2015 +0000 @@ -0,0 +1,101 @@ +/** mbed oscilloscope my implementation of a oscillo scope + * Copyright (c) 2014, 2015 Motoo Tanaka @ Design Methodology Lab + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#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) +#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 PIN_RESET_TFT PTB10 +#define PIN_ADC_CH0 PTB0 +#define PIN_ADC_CH1 PTB1 + +#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 PIN_RESET_TFT PTA20 +#define PIN_ADC_CH0 PTB0 +#define PIN_ADC_CH1 PTB1 + +#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 +#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_ADC_CH0 PTB2 +#define PIN_ADC_CH1 PTB3 + +#else + #error TARGET NOT DEFINED +#endif + +#define CHART_LEN 198 + +// NOTE: in case MIN_INTERVAL is too small +// the program hangs during ADC and timer interrupt +#define MIN_INTERVAL 30 +#define MAX_INTERVAL 20000 +#define NUM_MAX_MENU 20 +#define NUM_MAX_ANALOG_CH 2 +#define MODE_RUN 1 +#define MODE_STOP 0 + +#define opPlus 0 +#define opMinus 1 +#define opMul 2 +#define opDiv 3 + + +extern vt100 tty ; +extern AnalogIn *ach[] ; +extern Ticker timer ; + +extern DigitalOut backlight ; +extern ILI9341 TFT ; +extern SPI_STMPE610 TSC ; +extern TFTMenuItem *menu[] ; +extern int numMenu ; + +extern int num_digit ; +extern long prevValue ; +extern long topValue ; +extern int op ; + +void display(char *label = 0) ; +#endif /* _MAIN_H_ */ \ No newline at end of file