![](/media/cache/profiles/0d382a5fec7012c843c1bdfb0935c9a6.50x50_q85.jpg)
A simple meter using Adafruit 2.8 TFT with touch v2
Dependencies: SPI_STMPE610 UniGraphic mbed vt100
A dumb simple voltage tester using ADC.
With FRDM-KL25Z, you can measure about 0V to 3.28V.
Nothing to drop your jaw nor holding your breath
but I wanted one, so I wrote one ;-)
とても単純はADCを使用した電圧テスターです。
FRDM-KL25Z を使用した場合、0V ~ 3.28V くらいが測定範囲です。
特に目新しいことも、驚くこともありませんが、
自分が欲しいので書いてみました (^ - ^)
On 18-May-2018
I changed the number display from 0.00 to 0.000
so that I can measure the change of a small loadcell.
2018年5月18日
ロードセル (重量センサ)の出力値の変化を見たかったので
有効数字を小数点以下2桁から3桁に変更しました。
main.h@0:d01def9cf41e, 2017-07-20 (annotated)
- Committer:
- Rhyme
- Date:
- Thu Jul 20 02:37:13 2017 +0000
- Revision:
- 0:d01def9cf41e
first working version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:d01def9cf41e | 1 | /** mbed oscilloscope my implementation of a oscillo scope |
Rhyme | 0:d01def9cf41e | 2 | * Copyright (c) 2014, 2015 Motoo Tanaka @ Design Methodology Lab |
Rhyme | 0:d01def9cf41e | 3 | * |
Rhyme | 0:d01def9cf41e | 4 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Rhyme | 0:d01def9cf41e | 5 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Rhyme | 0:d01def9cf41e | 6 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
Rhyme | 0:d01def9cf41e | 7 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
Rhyme | 0:d01def9cf41e | 8 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Rhyme | 0:d01def9cf41e | 9 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
Rhyme | 0:d01def9cf41e | 10 | * THE SOFTWARE. |
Rhyme | 0:d01def9cf41e | 11 | */ |
Rhyme | 0:d01def9cf41e | 12 | #ifndef _MAIN_H_ |
Rhyme | 0:d01def9cf41e | 13 | #define _MAIN_H_ included |
Rhyme | 0:d01def9cf41e | 14 | |
Rhyme | 0:d01def9cf41e | 15 | #if defined (TARGET_KL25Z) |
Rhyme | 0:d01def9cf41e | 16 | #define PIN_SCLK PTD1 |
Rhyme | 0:d01def9cf41e | 17 | #define PIN_MISO PTD3 |
Rhyme | 0:d01def9cf41e | 18 | #define PIN_MOSI PTD2 |
Rhyme | 0:d01def9cf41e | 19 | #define PIN_CS_TFT PTD0 |
Rhyme | 0:d01def9cf41e | 20 | #define PIN_DC_TFT PTD5 |
Rhyme | 0:d01def9cf41e | 21 | #define PIN_CS_TSC PTA13 |
Rhyme | 0:d01def9cf41e | 22 | #define PIN_BL_TFT PTA12 |
Rhyme | 0:d01def9cf41e | 23 | #define PIN_CS_SD PTA4 |
Rhyme | 0:d01def9cf41e | 24 | #define PIN_TSC_INTR PTC9 /* place holder */ |
Rhyme | 0:d01def9cf41e | 25 | #define PIN_RESET_TFT PTB10 /* place holder */ |
Rhyme | 0:d01def9cf41e | 26 | #define PIN_ADC_CH0 PTB0 |
Rhyme | 0:d01def9cf41e | 27 | #define PIN_ADC_CH1 PTB2 |
Rhyme | 0:d01def9cf41e | 28 | |
Rhyme | 0:d01def9cf41e | 29 | #elif defined (TARGET_KL46Z) |
Rhyme | 0:d01def9cf41e | 30 | #define PIN_SCLK PTD5 |
Rhyme | 0:d01def9cf41e | 31 | #define PIN_MISO PTD7 |
Rhyme | 0:d01def9cf41e | 32 | #define PIN_MOSI PTD6 |
Rhyme | 0:d01def9cf41e | 33 | #define PIN_CS_TFT PTD4 |
Rhyme | 0:d01def9cf41e | 34 | #define PIN_DC_TFT PTD2 |
Rhyme | 0:d01def9cf41e | 35 | #define PIN_CS_TSC PTA13 |
Rhyme | 0:d01def9cf41e | 36 | #define PIN_BL_TFT PTC9 |
Rhyme | 0:d01def9cf41e | 37 | #define PIN_CS_SD PTA4 |
Rhyme | 0:d01def9cf41e | 38 | #define PIN_TSC_INTR PTC7 /* place holder */ |
Rhyme | 0:d01def9cf41e | 39 | #define PIN_RESET_TFT PTC6 /* place holder */ |
Rhyme | 0:d01def9cf41e | 40 | #define PIN_ADC_CH0 PTB0 |
Rhyme | 0:d01def9cf41e | 41 | #define PIN_ADC_CH1 PTB2 |
Rhyme | 0:d01def9cf41e | 42 | |
Rhyme | 0:d01def9cf41e | 43 | #elif defined (TARGET_K64F) |
Rhyme | 0:d01def9cf41e | 44 | #define PIN_SCLK PTD1 |
Rhyme | 0:d01def9cf41e | 45 | #define PIN_MISO PTD3 |
Rhyme | 0:d01def9cf41e | 46 | #define PIN_MOSI PTD2 |
Rhyme | 0:d01def9cf41e | 47 | #define PIN_CS_TFT PTD0 |
Rhyme | 0:d01def9cf41e | 48 | #define PIN_DC_TFT PTC4 |
Rhyme | 0:d01def9cf41e | 49 | // for board rev E or later |
Rhyme | 0:d01def9cf41e | 50 | #define PIN_CS_TSC PTC12 |
Rhyme | 0:d01def9cf41e | 51 | // for earlier boards use following line |
Rhyme | 0:d01def9cf41e | 52 | // #define PIN_CS_TSC PTA0 |
Rhyme | 0:d01def9cf41e | 53 | #define PIN_BL_TFT PTC3 |
Rhyme | 0:d01def9cf41e | 54 | #define PIN_CS_SD PTB23 |
Rhyme | 0:d01def9cf41e | 55 | #define PIN_TSC_INTR PTC0 /* place holder */ |
Rhyme | 0:d01def9cf41e | 56 | #define PIN_RESET_TFT PTC9 /* place holder */ |
Rhyme | 0:d01def9cf41e | 57 | #define PIN_ADC_CH0 PTB2 |
Rhyme | 0:d01def9cf41e | 58 | #define PIN_ADC_CH1 PTB10 |
Rhyme | 0:d01def9cf41e | 59 | |
Rhyme | 0:d01def9cf41e | 60 | #elif defined (TARGET_K22F) |
Rhyme | 0:d01def9cf41e | 61 | #define PIN_SCLK PTD5 |
Rhyme | 0:d01def9cf41e | 62 | #define PIN_MISO PTD7 |
Rhyme | 0:d01def9cf41e | 63 | #define PIN_MOSI PTD6 |
Rhyme | 0:d01def9cf41e | 64 | #define PIN_CS_TFT PTD4 |
Rhyme | 0:d01def9cf41e | 65 | #define PIN_DC_TFT PTA1 |
Rhyme | 0:d01def9cf41e | 66 | #define PIN_CS_TSC PTB19 |
Rhyme | 0:d01def9cf41e | 67 | #define PIN_BL_TFT PTC6 |
Rhyme | 0:d01def9cf41e | 68 | #define PIN_CS_SD PTA4 |
Rhyme | 0:d01def9cf41e | 69 | #define PIN_TSC_INTR PTC7 /* place holder */ |
Rhyme | 0:d01def9cf41e | 70 | #define PIN_RESET_TFT PTC9 /* place holder */ |
Rhyme | 0:d01def9cf41e | 71 | #define PIN_ADC_CH0 PTB0 |
Rhyme | 0:d01def9cf41e | 72 | #define PIN_ADC_CH1 PTC1 |
Rhyme | 0:d01def9cf41e | 73 | |
Rhyme | 0:d01def9cf41e | 74 | #elif defined (TARGET_NUCLEO_F411RE) |
Rhyme | 0:d01def9cf41e | 75 | #define PIN_SCLK PA_5 |
Rhyme | 0:d01def9cf41e | 76 | #define PIN_MISO PA_6 |
Rhyme | 0:d01def9cf41e | 77 | #define PIN_MOSI PA_7 |
Rhyme | 0:d01def9cf41e | 78 | #define PIN_CS_TFT PB_6 |
Rhyme | 0:d01def9cf41e | 79 | #define PIN_DC_TFT PC_7 |
Rhyme | 0:d01def9cf41e | 80 | #define PIN_CS_TSC PA_9 |
Rhyme | 0:d01def9cf41e | 81 | #define PIN_BL_TFT PA_8 |
Rhyme | 0:d01def9cf41e | 82 | #define PIN_CS_SD PB_5 |
Rhyme | 0:d01def9cf41e | 83 | #define PIN_TSC_INTR PA_8 /* place holder */ |
Rhyme | 0:d01def9cf41e | 84 | #define PIN_RESET_TFT PA_13 /* place holder */ |
Rhyme | 0:d01def9cf41e | 85 | #define PIN_ADC_CH0 PA_0 |
Rhyme | 0:d01def9cf41e | 86 | #define PIN_ADC_CH1 PA_4 |
Rhyme | 0:d01def9cf41e | 87 | |
Rhyme | 0:d01def9cf41e | 88 | #elif defined (TARGET_K20D50M) |
Rhyme | 0:d01def9cf41e | 89 | #define PIN_SCLK PTD1 |
Rhyme | 0:d01def9cf41e | 90 | #define PIN_MISO PTD3 |
Rhyme | 0:d01def9cf41e | 91 | #define PIN_MOSI PTD2 |
Rhyme | 0:d01def9cf41e | 92 | #define PIN_CS_TFT PTC2 |
Rhyme | 0:d01def9cf41e | 93 | #define PIN_DC_TFT PTA2 |
Rhyme | 0:d01def9cf41e | 94 | #define PIN_CS_TSC PTA12 |
Rhyme | 0:d01def9cf41e | 95 | #define PIN_BL_TFT PTC4 |
Rhyme | 0:d01def9cf41e | 96 | #define PIN_CS_SD PTC8 |
Rhyme | 0:d01def9cf41e | 97 | #define PIN_TSC_INTR PTA4 /* place holder */ |
Rhyme | 0:d01def9cf41e | 98 | #define PIN_RESET_TFT PTC7 /* place holder */ |
Rhyme | 0:d01def9cf41e | 99 | #define PIN_ADC_CH0 PTC0 |
Rhyme | 0:d01def9cf41e | 100 | #define PIN_ADC_CH1 PTD6 |
Rhyme | 0:d01def9cf41e | 101 | |
Rhyme | 0:d01def9cf41e | 102 | #elif defined (TARGET_RZ_A1H) |
Rhyme | 0:d01def9cf41e | 103 | #define PIN_SCLK P10_12 |
Rhyme | 0:d01def9cf41e | 104 | #define PIN_MISO P10_15 |
Rhyme | 0:d01def9cf41e | 105 | #define PIN_MOSI P10_14 |
Rhyme | 0:d01def9cf41e | 106 | #define PIN_CS_TFT P10_13 |
Rhyme | 0:d01def9cf41e | 107 | #define PIN_DC_TFT P8_14 |
Rhyme | 0:d01def9cf41e | 108 | #define PIN_CS_TSC P8_15 |
Rhyme | 0:d01def9cf41e | 109 | #define PIN_BL_TFT P8_11 |
Rhyme | 0:d01def9cf41e | 110 | #define PIN_CS_SD P4_5 |
Rhyme | 0:d01def9cf41e | 111 | #define PIN_TSC_INTR P2_9 /* place holder */ |
Rhyme | 0:d01def9cf41e | 112 | #define PIN_RESET_TFT P2_10 /* place holder */ |
Rhyme | 0:d01def9cf41e | 113 | #define PIN_ADC_CH0 P1_8 |
Rhyme | 0:d01def9cf41e | 114 | #define PIN_ADC_CH1 P1_10 |
Rhyme | 0:d01def9cf41e | 115 | #elif defined (TARGET_MAX32600MBED) |
Rhyme | 0:d01def9cf41e | 116 | /* I2C */ |
Rhyme | 0:d01def9cf41e | 117 | #define PIN_SCL P2_7 |
Rhyme | 0:d01def9cf41e | 118 | #define PIN_SDA P2_6 |
Rhyme | 0:d01def9cf41e | 119 | /* SPI */ |
Rhyme | 0:d01def9cf41e | 120 | #define PIN_SCLK P2_0 |
Rhyme | 0:d01def9cf41e | 121 | #define PIN_MISO P2_2 |
Rhyme | 0:d01def9cf41e | 122 | #define PIN_MOSI P2_1 |
Rhyme | 0:d01def9cf41e | 123 | #define PIN_CS0 P2_3 |
Rhyme | 0:d01def9cf41e | 124 | /* Interrupt */ |
Rhyme | 0:d01def9cf41e | 125 | #define PIN_INT0 P2_4 |
Rhyme | 0:d01def9cf41e | 126 | #define PIN_INT1 P2_5 |
Rhyme | 0:d01def9cf41e | 127 | #define PIN_INT2 P1_7 |
Rhyme | 0:d01def9cf41e | 128 | #define PIN_INT3 P1_6 |
Rhyme | 0:d01def9cf41e | 129 | #define PIN_INT4 P1_5 |
Rhyme | 0:d01def9cf41e | 130 | #define PIN_INT5 P1_4 |
Rhyme | 0:d01def9cf41e | 131 | /* Analog In */ |
Rhyme | 0:d01def9cf41e | 132 | #define PIN_AN0 AIN_0P |
Rhyme | 0:d01def9cf41e | 133 | #define PIN_AN1 AIN_1P |
Rhyme | 0:d01def9cf41e | 134 | #define PIN_AN2 AIN_2P |
Rhyme | 0:d01def9cf41e | 135 | #define PIN_AN3 AIN_3P |
Rhyme | 0:d01def9cf41e | 136 | #define PIN_AN4 AIN_4P |
Rhyme | 0:d01def9cf41e | 137 | #define PIN_AN5 AIN_5P |
Rhyme | 0:d01def9cf41e | 138 | #define BOARD_NAME "MAX32600MBED" |
Rhyme | 0:d01def9cf41e | 139 | |
Rhyme | 0:d01def9cf41e | 140 | #define PIN_CS_TFT P2_3 // D10 PTD0 |
Rhyme | 0:d01def9cf41e | 141 | #define PIN_DC_TFT P2_4 // D9 PTD5 |
Rhyme | 0:d01def9cf41e | 142 | #define PIN_CS_TSC P2_5 // D8 PTA13 |
Rhyme | 0:d01def9cf41e | 143 | #define PIN_BL_TFT P1_7 // D7 PTC9 |
Rhyme | 0:d01def9cf41e | 144 | #define PIN_CS_SD P1_4 // D4 PTA4 |
Rhyme | 0:d01def9cf41e | 145 | #define PIN_TSC_INTR P5_4 // PTC9 /* place holder */ |
Rhyme | 0:d01def9cf41e | 146 | #define PIN_RESET_TFT P5_5 /// PTB10 /* place holder */ |
Rhyme | 0:d01def9cf41e | 147 | #define PIN_ADC_CH0 AIN_0P // A0 PTB0 |
Rhyme | 0:d01def9cf41e | 148 | #define PIN_ADC_CH1 AIN_2P // A2 PTB2 |
Rhyme | 0:d01def9cf41e | 149 | |
Rhyme | 0:d01def9cf41e | 150 | #else |
Rhyme | 0:d01def9cf41e | 151 | #error TARGET NOT DEFINED |
Rhyme | 0:d01def9cf41e | 152 | #define PIN_SCLK D13 |
Rhyme | 0:d01def9cf41e | 153 | #define PIN_MISO D12 |
Rhyme | 0:d01def9cf41e | 154 | #define PIN_MOSI D11 |
Rhyme | 0:d01def9cf41e | 155 | #define PIN_CS_TFT D10 |
Rhyme | 0:d01def9cf41e | 156 | #define PIN_DC_TFT D9 |
Rhyme | 0:d01def9cf41e | 157 | #define PIN_CS_TSC D8 |
Rhyme | 0:d01def9cf41e | 158 | #define PIN_BL_TFT D7 |
Rhyme | 0:d01def9cf41e | 159 | #define PIN_CS_SD D4 |
Rhyme | 0:d01def9cf41e | 160 | #define PIN_TSC_INTR D5-inside /* place holder */ |
Rhyme | 0:d01def9cf41e | 161 | #define PIN_RESET_TFT D4-inside /* place holder */ |
Rhyme | 0:d01def9cf41e | 162 | #define PIN_ADC_CH0 A0 |
Rhyme | 0:d01def9cf41e | 163 | #define PIN_ADC_CH1 A2 |
Rhyme | 0:d01def9cf41e | 164 | |
Rhyme | 0:d01def9cf41e | 165 | #endif |
Rhyme | 0:d01def9cf41e | 166 | |
Rhyme | 0:d01def9cf41e | 167 | #endif /* _MAIN_H_ */ |