aaa
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
main.cpp@6:cd0294454118, 2014-10-25 (annotated)
- Committer:
- bhavk11
- Date:
- Sat Oct 25 17:27:37 2014 +0000
- Revision:
- 6:cd0294454118
- Parent:
- 5:4add240cef16
- Child:
- 7:11eb2c8df6a9
texting
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lawliet | 1:b2794eb7c940 | 1 | /* |
lawliet | 1:b2794eb7c940 | 2 | main.cpp |
lawliet | 1:b2794eb7c940 | 3 | 2014 Copyright (c) Seeed Technology Inc. All right reserved. |
lawliet | 1:b2794eb7c940 | 4 | |
lawliet | 1:b2794eb7c940 | 5 | Author:lawliet zou(lawliet.zou@gmail.com) |
lawliet | 1:b2794eb7c940 | 6 | 2014-02-17 |
lawliet | 1:b2794eb7c940 | 7 | |
lawliet | 1:b2794eb7c940 | 8 | This library is free software; you can redistribute it and/or |
lawliet | 1:b2794eb7c940 | 9 | modify it under the terms of the GNU Lesser General Public |
lawliet | 1:b2794eb7c940 | 10 | License as published by the Free Software Foundation; either |
lawliet | 1:b2794eb7c940 | 11 | version 2.1 of the License, or (at your option) any later version. |
lawliet | 1:b2794eb7c940 | 12 | |
lawliet | 1:b2794eb7c940 | 13 | This library is distributed in the hope that it will be useful, |
lawliet | 1:b2794eb7c940 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
lawliet | 1:b2794eb7c940 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
lawliet | 1:b2794eb7c940 | 16 | Lesser General Public License for more details. |
lawliet | 1:b2794eb7c940 | 17 | |
lawliet | 1:b2794eb7c940 | 18 | You should have received a copy of the GNU Lesser General Public |
lawliet | 1:b2794eb7c940 | 19 | License along with this library; if not, write to the Free Software |
lawliet | 1:b2794eb7c940 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
lawliet | 1:b2794eb7c940 | 21 | */ |
lawliet | 1:b2794eb7c940 | 22 | |
neilt6 | 0:407dafce805d | 23 | #include "mbed.h" |
neilt6 | 0:407dafce805d | 24 | #include "SeeedStudioTFTv2.h" |
neilt6 | 0:407dafce805d | 25 | #include "Arial12x12.h" |
neilt6 | 0:407dafce805d | 26 | #include "Arial24x23.h" |
neilt6 | 0:407dafce805d | 27 | #include "Arial28x28.h" |
neilt6 | 0:407dafce805d | 28 | #include "font_big.h" |
neilt6 | 0:407dafce805d | 29 | |
screamer | 2:5c2f6ff36ff1 | 30 | #define PIN_XP A3 |
screamer | 2:5c2f6ff36ff1 | 31 | #define PIN_XM A1 |
screamer | 2:5c2f6ff36ff1 | 32 | #define PIN_YP A2 |
screamer | 2:5c2f6ff36ff1 | 33 | #define PIN_YM A0 |
screamer | 2:5c2f6ff36ff1 | 34 | #define PIN_MOSI D11 |
screamer | 2:5c2f6ff36ff1 | 35 | #define PIN_MISO D12 |
screamer | 2:5c2f6ff36ff1 | 36 | #define PIN_SCLK D13 |
screamer | 2:5c2f6ff36ff1 | 37 | #define PIN_CS_TFT D5 |
screamer | 2:5c2f6ff36ff1 | 38 | #define PIN_DC_TFT D6 |
screamer | 2:5c2f6ff36ff1 | 39 | #define PIN_BL_TFT D7 |
screamer | 2:5c2f6ff36ff1 | 40 | #define PIN_CS_SD D4 |
lawliet | 1:b2794eb7c940 | 41 | |
bhavk11 | 4:5b088ba4f1f1 | 42 | Timer t; |
bhavk11 | 4:5b088ba4f1f1 | 43 | Serial pc(USBTX,USBRX); |
screamer | 2:5c2f6ff36ff1 | 44 | SeeedStudioTFTv2 TFT(PIN_XP, PIN_XM, PIN_YP, PIN_YM, PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TFT, PIN_DC_TFT, PIN_BL_TFT, PIN_CS_SD); |
neilt6 | 0:407dafce805d | 45 | |
bhavk11 | 6:cd0294454118 | 46 | char ip0[] = {' ','0','+'}; |
bhavk11 | 6:cd0294454118 | 47 | char ip2[] = {'a','b','c','2'}; |
bhavk11 | 6:cd0294454118 | 48 | char ip3[] = {'d','e','f','3'}; |
bhavk11 | 6:cd0294454118 | 49 | char ip4[] = {'g','h','i','4'}; |
bhavk11 | 6:cd0294454118 | 50 | char ip5[] = {'j','k','l','5'}; |
bhavk11 | 6:cd0294454118 | 51 | char ip6[] = {'m','o','p','6'}; |
bhavk11 | 6:cd0294454118 | 52 | char ip7[] = {'p','q','r','s','7'}; |
bhavk11 | 6:cd0294454118 | 53 | char ip8[] = {'t','u','v','8'}; |
bhavk11 | 6:cd0294454118 | 54 | char ip9[] = {'w','x','y','z','9'}; |
bhavk11 | 6:cd0294454118 | 55 | |
bhavk11 | 4:5b088ba4f1f1 | 56 | void printKey(int x, int y, char* digit, char* alphas) |
bhavk11 | 4:5b088ba4f1f1 | 57 | { |
bhavk11 | 4:5b088ba4f1f1 | 58 | TFT.foreground(Blue); |
bhavk11 | 4:5b088ba4f1f1 | 59 | TFT.set_font((unsigned char*) Arial24x23); |
bhavk11 | 4:5b088ba4f1f1 | 60 | TFT.locate(x,y); |
bhavk11 | 4:5b088ba4f1f1 | 61 | TFT.printf(digit); |
bhavk11 | 4:5b088ba4f1f1 | 62 | TFT.foreground(Black); |
bhavk11 | 4:5b088ba4f1f1 | 63 | TFT.set_font((unsigned char*) Arial12x12); |
bhavk11 | 4:5b088ba4f1f1 | 64 | TFT.locate(x+15,y+10); |
bhavk11 | 4:5b088ba4f1f1 | 65 | TFT.printf(alphas); |
bhavk11 | 4:5b088ba4f1f1 | 66 | } |
bhavk11 | 4:5b088ba4f1f1 | 67 | |
bhavk11 | 4:5b088ba4f1f1 | 68 | void initKeypad() |
bhavk11 | 4:5b088ba4f1f1 | 69 | { |
bhavk11 | 4:5b088ba4f1f1 | 70 | TFT.background(White); |
bhavk11 | 4:5b088ba4f1f1 | 71 | TFT.cls(); |
bhavk11 | 4:5b088ba4f1f1 | 72 | TFT.foreground(Black); |
bhavk11 | 4:5b088ba4f1f1 | 73 | TFT.set_font((unsigned char*) Arial12x12); |
bhavk11 | 4:5b088ba4f1f1 | 74 | TFT.locate(210,84); |
bhavk11 | 4:5b088ba4f1f1 | 75 | TFT.printf("Del"); |
bhavk11 | 4:5b088ba4f1f1 | 76 | TFT.line(0,100,240,100,Black); |
bhavk11 | 4:5b088ba4f1f1 | 77 | TFT.rect(205,80,235,95,Black); |
bhavk11 | 4:5b088ba4f1f1 | 78 | TFT.line(205,80,195,95,White); |
bhavk11 | 4:5b088ba4f1f1 | 79 | TFT.line(192,87,205,80,Black); |
bhavk11 | 4:5b088ba4f1f1 | 80 | TFT.line(192,87,205,95,Black); |
bhavk11 | 4:5b088ba4f1f1 | 81 | printKey(20,120,"1"," "); |
bhavk11 | 4:5b088ba4f1f1 | 82 | printKey(95,120,"2","ABC"); |
bhavk11 | 4:5b088ba4f1f1 | 83 | printKey(170,120,"3","DEF"); |
bhavk11 | 4:5b088ba4f1f1 | 84 | printKey(20,160,"4","GHI"); |
bhavk11 | 4:5b088ba4f1f1 | 85 | printKey(95,160,"5","JKL"); |
bhavk11 | 4:5b088ba4f1f1 | 86 | printKey(170,160,"6","MNO"); |
bhavk11 | 4:5b088ba4f1f1 | 87 | printKey(20,200,"7","PQRS"); |
bhavk11 | 4:5b088ba4f1f1 | 88 | printKey(95,200,"8","TUV"); |
bhavk11 | 4:5b088ba4f1f1 | 89 | printKey(170,200,"9","WXYZ"); |
bhavk11 | 4:5b088ba4f1f1 | 90 | printKey(20,240,"*",""); |
bhavk11 | 4:5b088ba4f1f1 | 91 | printKey(95,240,"0","+"); |
bhavk11 | 4:5b088ba4f1f1 | 92 | printKey(170,240,"#",""); |
bhavk11 | 4:5b088ba4f1f1 | 93 | printKey(20,280,"<--",""); |
bhavk11 | 4:5b088ba4f1f1 | 94 | } |
bhavk11 | 4:5b088ba4f1f1 | 95 | |
bhavk11 | 4:5b088ba4f1f1 | 96 | int getKey() |
bhavk11 | 4:5b088ba4f1f1 | 97 | { |
bhavk11 | 4:5b088ba4f1f1 | 98 | int key = -1; |
bhavk11 | 4:5b088ba4f1f1 | 99 | point p; |
bhavk11 | 4:5b088ba4f1f1 | 100 | int count = 0; |
bhavk11 | 4:5b088ba4f1f1 | 101 | if(TFT.getTouch(p) == TFT.NO || TFT.getTouch(p) == TFT.MAYBE) |
bhavk11 | 4:5b088ba4f1f1 | 102 | { return key; |
bhavk11 | 4:5b088ba4f1f1 | 103 | } |
bhavk11 | 4:5b088ba4f1f1 | 104 | while(TFT.getTouch(p) == TFT.YES) |
bhavk11 | 4:5b088ba4f1f1 | 105 | { |
bhavk11 | 4:5b088ba4f1f1 | 106 | count++; |
bhavk11 | 4:5b088ba4f1f1 | 107 | } |
bhavk11 | 4:5b088ba4f1f1 | 108 | if(count > 300) |
bhavk11 | 4:5b088ba4f1f1 | 109 | { |
bhavk11 | 4:5b088ba4f1f1 | 110 | //TFT.foreground(Black); |
bhavk11 | 4:5b088ba4f1f1 | 111 | // TFT.set_font((unsigned char*) Arial12x12); |
bhavk11 | 4:5b088ba4f1f1 | 112 | // TFT.locate(0,0); |
bhavk11 | 4:5b088ba4f1f1 | 113 | // TFT.printf("X:%d, Y:%d\n\r",p.x,p.y); |
bhavk11 | 4:5b088ba4f1f1 | 114 | if (p.x>2700 && p.x<7250) |
bhavk11 | 4:5b088ba4f1f1 | 115 | { |
bhavk11 | 4:5b088ba4f1f1 | 116 | if(p.x<3750) |
bhavk11 | 4:5b088ba4f1f1 | 117 | { |
bhavk11 | 4:5b088ba4f1f1 | 118 | if(p.y<3000) |
bhavk11 | 4:5b088ba4f1f1 | 119 | key = 1; //1 |
bhavk11 | 4:5b088ba4f1f1 | 120 | else if(p.y<5250) |
bhavk11 | 4:5b088ba4f1f1 | 121 | key = 2; //2 |
bhavk11 | 4:5b088ba4f1f1 | 122 | else |
bhavk11 | 4:5b088ba4f1f1 | 123 | key = 3; //3 |
bhavk11 | 4:5b088ba4f1f1 | 124 | } |
bhavk11 | 4:5b088ba4f1f1 | 125 | else if(p.x<4600) |
bhavk11 | 4:5b088ba4f1f1 | 126 | { |
bhavk11 | 4:5b088ba4f1f1 | 127 | if(p.y<3000) |
bhavk11 | 4:5b088ba4f1f1 | 128 | key = 4; //4 |
bhavk11 | 4:5b088ba4f1f1 | 129 | else if(p.y<5250) |
bhavk11 | 4:5b088ba4f1f1 | 130 | key = 5; //5 |
bhavk11 | 4:5b088ba4f1f1 | 131 | else |
bhavk11 | 4:5b088ba4f1f1 | 132 | key = 6; //6 |
bhavk11 | 4:5b088ba4f1f1 | 133 | } |
bhavk11 | 4:5b088ba4f1f1 | 134 | else if(p.x<5400) |
bhavk11 | 4:5b088ba4f1f1 | 135 | { |
bhavk11 | 4:5b088ba4f1f1 | 136 | if(p.y<3000) |
bhavk11 | 4:5b088ba4f1f1 | 137 | key = 7; //7 |
bhavk11 | 4:5b088ba4f1f1 | 138 | else if(p.y<5250) |
bhavk11 | 4:5b088ba4f1f1 | 139 | key = 8; //8 |
bhavk11 | 4:5b088ba4f1f1 | 140 | else |
bhavk11 | 4:5b088ba4f1f1 | 141 | key = 9; //9 |
bhavk11 | 4:5b088ba4f1f1 | 142 | } |
bhavk11 | 4:5b088ba4f1f1 | 143 | else if(p.x<6300) |
bhavk11 | 4:5b088ba4f1f1 | 144 | { |
bhavk11 | 4:5b088ba4f1f1 | 145 | if(p.y<3000) |
bhavk11 | 4:5b088ba4f1f1 | 146 | key = 42; //* |
bhavk11 | 4:5b088ba4f1f1 | 147 | else if(p.y<5250) |
bhavk11 | 4:5b088ba4f1f1 | 148 | key = 0; //0 |
bhavk11 | 4:5b088ba4f1f1 | 149 | else |
bhavk11 | 4:5b088ba4f1f1 | 150 | key = 35; //# |
bhavk11 | 4:5b088ba4f1f1 | 151 | } |
bhavk11 | 4:5b088ba4f1f1 | 152 | else |
bhavk11 | 4:5b088ba4f1f1 | 153 | { |
bhavk11 | 4:5b088ba4f1f1 | 154 | if(p.y<3000) |
bhavk11 | 4:5b088ba4f1f1 | 155 | key = 60; // back |
bhavk11 | 4:5b088ba4f1f1 | 156 | else |
bhavk11 | 4:5b088ba4f1f1 | 157 | key = 43; // go (call/text) |
bhavk11 | 4:5b088ba4f1f1 | 158 | } |
bhavk11 | 4:5b088ba4f1f1 | 159 | } |
bhavk11 | 4:5b088ba4f1f1 | 160 | if(p.x > 2200 && p.x < 2500 && p.y > 6200 && p.y < 7000) |
bhavk11 | 4:5b088ba4f1f1 | 161 | key = 127; |
bhavk11 | 4:5b088ba4f1f1 | 162 | } |
bhavk11 | 4:5b088ba4f1f1 | 163 | return key; |
bhavk11 | 4:5b088ba4f1f1 | 164 | } |
bhavk11 | 4:5b088ba4f1f1 | 165 | |
bhavk11 | 4:5b088ba4f1f1 | 166 | bool displayChar(point& cursor, char letter) |
bhavk11 | 4:5b088ba4f1f1 | 167 | { |
bhavk11 | 4:5b088ba4f1f1 | 168 | TFT.locate(cursor.x,cursor.y); |
bhavk11 | 6:cd0294454118 | 169 | if(cursor.x + 12 <= 228) |
bhavk11 | 6:cd0294454118 | 170 | cursor.x += 12; |
bhavk11 | 4:5b088ba4f1f1 | 171 | else |
bhavk11 | 4:5b088ba4f1f1 | 172 | { |
bhavk11 | 4:5b088ba4f1f1 | 173 | cursor.x = 0; |
bhavk11 | 4:5b088ba4f1f1 | 174 | if(cursor.y + 21 <= 65 ) |
bhavk11 | 4:5b088ba4f1f1 | 175 | cursor.y += 21; |
bhavk11 | 4:5b088ba4f1f1 | 176 | else |
bhavk11 | 4:5b088ba4f1f1 | 177 | return false; |
bhavk11 | 4:5b088ba4f1f1 | 178 | } |
bhavk11 | 6:cd0294454118 | 179 | TFT.set_font((unsigned char*) Arial12x12); |
bhavk11 | 4:5b088ba4f1f1 | 180 | TFT.printf("%c",letter); |
bhavk11 | 4:5b088ba4f1f1 | 181 | return true; |
bhavk11 | 4:5b088ba4f1f1 | 182 | } |
bhavk11 | 4:5b088ba4f1f1 | 183 | |
bhavk11 | 6:cd0294454118 | 184 | int getAlpha(point& x, char* pt) |
bhavk11 | 6:cd0294454118 | 185 | { |
bhavk11 | 6:cd0294454118 | 186 | int touchCount = 1, count = 1; |
bhavk11 | 6:cd0294454118 | 187 | int key, begin, end; |
bhavk11 | 6:cd0294454118 | 188 | int prevKey; |
bhavk11 | 6:cd0294454118 | 189 | do { |
bhavk11 | 6:cd0294454118 | 190 | prevKey = key = getKey(); |
bhavk11 | 6:cd0294454118 | 191 | }while(prevKey == -1); |
bhavk11 | 6:cd0294454118 | 192 | |
bhavk11 | 6:cd0294454118 | 193 | point cursor = x; |
bhavk11 | 6:cd0294454118 | 194 | char* ptr = pt; |
bhavk11 | 6:cd0294454118 | 195 | t.reset(); |
bhavk11 | 6:cd0294454118 | 196 | t.start(); |
bhavk11 | 6:cd0294454118 | 197 | begin = t.read_ms(); |
bhavk11 | 6:cd0294454118 | 198 | end = t.read_ms(); |
bhavk11 | 6:cd0294454118 | 199 | while((end - begin) < 2000) |
bhavk11 | 6:cd0294454118 | 200 | { |
bhavk11 | 6:cd0294454118 | 201 | cursor = x; |
bhavk11 | 6:cd0294454118 | 202 | ptr = pt; |
bhavk11 | 6:cd0294454118 | 203 | touchCount = count; |
bhavk11 | 6:cd0294454118 | 204 | switch(key) |
bhavk11 | 6:cd0294454118 | 205 | { |
bhavk11 | 6:cd0294454118 | 206 | case 0: |
bhavk11 | 6:cd0294454118 | 207 | touchCount = (touchCount-1)%(sizeof(ip0)/sizeof(ip0[0])); |
bhavk11 | 6:cd0294454118 | 208 | if(displayChar(cursor, ip0[touchCount])) { |
bhavk11 | 6:cd0294454118 | 209 | *ptr = ip0[touchCount]; |
bhavk11 | 6:cd0294454118 | 210 | ptr++; |
bhavk11 | 6:cd0294454118 | 211 | } |
bhavk11 | 6:cd0294454118 | 212 | break; |
bhavk11 | 6:cd0294454118 | 213 | case 1: |
bhavk11 | 6:cd0294454118 | 214 | if(displayChar(cursor, '1')) { |
bhavk11 | 6:cd0294454118 | 215 | *ptr = '1'; |
bhavk11 | 6:cd0294454118 | 216 | ptr++; |
bhavk11 | 6:cd0294454118 | 217 | } |
bhavk11 | 6:cd0294454118 | 218 | break; |
bhavk11 | 6:cd0294454118 | 219 | case 2: |
bhavk11 | 6:cd0294454118 | 220 | pc.printf("AAYA\r\n"); |
bhavk11 | 6:cd0294454118 | 221 | touchCount = (touchCount-1)%(sizeof(ip2)/sizeof(ip2[0])); |
bhavk11 | 6:cd0294454118 | 222 | if(displayChar(cursor, ip2[touchCount])) { |
bhavk11 | 6:cd0294454118 | 223 | *ptr = ip2[touchCount]; |
bhavk11 | 6:cd0294454118 | 224 | ptr++; |
bhavk11 | 6:cd0294454118 | 225 | } |
bhavk11 | 6:cd0294454118 | 226 | break; |
bhavk11 | 6:cd0294454118 | 227 | case 3: |
bhavk11 | 6:cd0294454118 | 228 | touchCount = (touchCount-1)%(sizeof(ip3)/sizeof(ip3[0])); |
bhavk11 | 6:cd0294454118 | 229 | if(displayChar(cursor, ip3[touchCount])) { |
bhavk11 | 6:cd0294454118 | 230 | *ptr = ip3[touchCount]; |
bhavk11 | 6:cd0294454118 | 231 | ptr++; |
bhavk11 | 6:cd0294454118 | 232 | } |
bhavk11 | 6:cd0294454118 | 233 | break; |
bhavk11 | 6:cd0294454118 | 234 | case 4: |
bhavk11 | 6:cd0294454118 | 235 | touchCount = (touchCount-1)%(sizeof(ip4)/sizeof(ip4[0])); |
bhavk11 | 6:cd0294454118 | 236 | if(displayChar(cursor, ip4[touchCount])) { |
bhavk11 | 6:cd0294454118 | 237 | *ptr = ip4[touchCount]; |
bhavk11 | 6:cd0294454118 | 238 | ptr++; |
bhavk11 | 6:cd0294454118 | 239 | } |
bhavk11 | 6:cd0294454118 | 240 | break; |
bhavk11 | 6:cd0294454118 | 241 | case 5: |
bhavk11 | 6:cd0294454118 | 242 | touchCount = (touchCount-1)%(sizeof(ip5)/sizeof(ip5[0])); |
bhavk11 | 6:cd0294454118 | 243 | if(displayChar(cursor, ip5[touchCount])) { |
bhavk11 | 6:cd0294454118 | 244 | *ptr = ip5[touchCount]; |
bhavk11 | 6:cd0294454118 | 245 | ptr++; |
bhavk11 | 6:cd0294454118 | 246 | } |
bhavk11 | 6:cd0294454118 | 247 | break; |
bhavk11 | 6:cd0294454118 | 248 | case 6: |
bhavk11 | 6:cd0294454118 | 249 | touchCount = (touchCount-1)%(sizeof(ip6)/sizeof(ip6[0])); |
bhavk11 | 6:cd0294454118 | 250 | if(displayChar(cursor, ip6[touchCount])) { |
bhavk11 | 6:cd0294454118 | 251 | *ptr = ip6[touchCount]; |
bhavk11 | 6:cd0294454118 | 252 | ptr++; |
bhavk11 | 6:cd0294454118 | 253 | } |
bhavk11 | 6:cd0294454118 | 254 | break; |
bhavk11 | 6:cd0294454118 | 255 | case 7: |
bhavk11 | 6:cd0294454118 | 256 | touchCount = (touchCount-1)%(sizeof(ip7)/sizeof(ip7[0])); |
bhavk11 | 6:cd0294454118 | 257 | if(displayChar(cursor, ip7[touchCount])) { |
bhavk11 | 6:cd0294454118 | 258 | *ptr = ip7[touchCount]; |
bhavk11 | 6:cd0294454118 | 259 | ptr++; |
bhavk11 | 6:cd0294454118 | 260 | } |
bhavk11 | 6:cd0294454118 | 261 | break; |
bhavk11 | 6:cd0294454118 | 262 | case 8: |
bhavk11 | 6:cd0294454118 | 263 | touchCount = (touchCount-1)%(sizeof(ip8)/sizeof(ip8[0])); |
bhavk11 | 6:cd0294454118 | 264 | if(displayChar(cursor, ip8[touchCount])) { |
bhavk11 | 6:cd0294454118 | 265 | *ptr = ip8[touchCount]; |
bhavk11 | 6:cd0294454118 | 266 | ptr++; |
bhavk11 | 6:cd0294454118 | 267 | } |
bhavk11 | 6:cd0294454118 | 268 | break; |
bhavk11 | 6:cd0294454118 | 269 | case 9: |
bhavk11 | 6:cd0294454118 | 270 | touchCount = (touchCount-1)%(sizeof(ip9)/sizeof(ip9[0])); |
bhavk11 | 6:cd0294454118 | 271 | if(displayChar(cursor, ip9[touchCount])) { |
bhavk11 | 6:cd0294454118 | 272 | *ptr = ip9[touchCount]; |
bhavk11 | 6:cd0294454118 | 273 | ptr++; |
bhavk11 | 6:cd0294454118 | 274 | } |
bhavk11 | 6:cd0294454118 | 275 | break; |
bhavk11 | 6:cd0294454118 | 276 | case 35: |
bhavk11 | 6:cd0294454118 | 277 | if(displayChar(cursor, '#')) { |
bhavk11 | 6:cd0294454118 | 278 | *ptr = '#'; |
bhavk11 | 6:cd0294454118 | 279 | ptr++; |
bhavk11 | 6:cd0294454118 | 280 | } |
bhavk11 | 6:cd0294454118 | 281 | break; |
bhavk11 | 6:cd0294454118 | 282 | case 42: |
bhavk11 | 6:cd0294454118 | 283 | if(displayChar(cursor, '*')) { |
bhavk11 | 6:cd0294454118 | 284 | *ptr = '*'; |
bhavk11 | 6:cd0294454118 | 285 | ptr++; |
bhavk11 | 6:cd0294454118 | 286 | } |
bhavk11 | 6:cd0294454118 | 287 | break; |
bhavk11 | 6:cd0294454118 | 288 | } |
bhavk11 | 6:cd0294454118 | 289 | |
bhavk11 | 6:cd0294454118 | 290 | key = getKey(); |
bhavk11 | 6:cd0294454118 | 291 | end = t.read_ms(); |
bhavk11 | 6:cd0294454118 | 292 | if(key == -1) continue; |
bhavk11 | 6:cd0294454118 | 293 | |
bhavk11 | 6:cd0294454118 | 294 | if(!(prevKey == key)){ |
bhavk11 | 6:cd0294454118 | 295 | break; |
bhavk11 | 6:cd0294454118 | 296 | } |
bhavk11 | 6:cd0294454118 | 297 | count++; |
bhavk11 | 6:cd0294454118 | 298 | |
bhavk11 | 6:cd0294454118 | 299 | pc.printf("ok curr count :%d key : %d prev_key : %d \r\n", touchCount,key, prevKey); |
bhavk11 | 6:cd0294454118 | 300 | } |
bhavk11 | 6:cd0294454118 | 301 | t.stop(); |
bhavk11 | 6:cd0294454118 | 302 | pc.printf("ok count is :%d \r\n", touchCount); |
bhavk11 | 6:cd0294454118 | 303 | |
bhavk11 | 6:cd0294454118 | 304 | if(cursor.x + 12 <= 228) |
bhavk11 | 6:cd0294454118 | 305 | cursor.x += 12; |
bhavk11 | 6:cd0294454118 | 306 | else |
bhavk11 | 6:cd0294454118 | 307 | { |
bhavk11 | 6:cd0294454118 | 308 | cursor.x = 0; |
bhavk11 | 6:cd0294454118 | 309 | if(cursor.y + 21 <= 65 ) |
bhavk11 | 6:cd0294454118 | 310 | cursor.y += 21; |
bhavk11 | 6:cd0294454118 | 311 | } |
bhavk11 | 6:cd0294454118 | 312 | |
bhavk11 | 6:cd0294454118 | 313 | x = cursor; |
bhavk11 | 6:cd0294454118 | 314 | pt = ptr; |
bhavk11 | 6:cd0294454118 | 315 | return prevKey; |
bhavk11 | 6:cd0294454118 | 316 | } |
bhavk11 | 6:cd0294454118 | 317 | |
neilt6 | 0:407dafce805d | 318 | int main() |
neilt6 | 0:407dafce805d | 319 | { |
bhavk11 | 4:5b088ba4f1f1 | 320 | point p; |
bhavk11 | 4:5b088ba4f1f1 | 321 | char* cmd = NULL; |
neilt6 | 0:407dafce805d | 322 | //Configure the display driver |
neilt6 | 0:407dafce805d | 323 | TFT.background(Black); |
neilt6 | 0:407dafce805d | 324 | TFT.foreground(White); |
neilt6 | 0:407dafce805d | 325 | TFT.cls(); |
neilt6 | 0:407dafce805d | 326 | |
bhavk11 | 4:5b088ba4f1f1 | 327 | while(true) |
bhavk11 | 4:5b088ba4f1f1 | 328 | { |
bhavk11 | 4:5b088ba4f1f1 | 329 | //Print a welcome message |
bhavk11 | 4:5b088ba4f1f1 | 330 | TFT.background(White); |
bhavk11 | 4:5b088ba4f1f1 | 331 | TFT.set_font((unsigned char*) Neu42x35); |
bhavk11 | 4:5b088ba4f1f1 | 332 | TFT.foreground(Maroon); |
bhavk11 | 4:5b088ba4f1f1 | 333 | TFT.cls(); |
bhavk11 | 4:5b088ba4f1f1 | 334 | TFT.locate(100,60); |
bhavk11 | 4:5b088ba4f1f1 | 335 | TFT.printf("IU"); |
bhavk11 | 4:5b088ba4f1f1 | 336 | |
bhavk11 | 4:5b088ba4f1f1 | 337 | TFT.set_font((unsigned char*) Arial24x23); |
bhavk11 | 4:5b088ba4f1f1 | 338 | TFT.locate(28,230); |
bhavk11 | 4:5b088ba4f1f1 | 339 | TFT.printf("CALL"); |
bhavk11 | 4:5b088ba4f1f1 | 340 | TFT.circle(60,240,50,Maroon); |
bhavk11 | 4:5b088ba4f1f1 | 341 | |
bhavk11 | 4:5b088ba4f1f1 | 342 | TFT.locate(140,230); |
bhavk11 | 4:5b088ba4f1f1 | 343 | TFT.printf("TEXT"); |
bhavk11 | 4:5b088ba4f1f1 | 344 | TFT.circle(180,240,50,Maroon); |
bhavk11 | 4:5b088ba4f1f1 | 345 | |
bhavk11 | 4:5b088ba4f1f1 | 346 | while(true) |
bhavk11 | 4:5b088ba4f1f1 | 347 | { |
bhavk11 | 4:5b088ba4f1f1 | 348 | if (TFT.getTouch(p) == TFT.YES) |
bhavk11 | 4:5b088ba4f1f1 | 349 | { |
bhavk11 | 4:5b088ba4f1f1 | 350 | if(p.x >= 4500 && p.x <= 6600) |
bhavk11 | 4:5b088ba4f1f1 | 351 | { |
bhavk11 | 4:5b088ba4f1f1 | 352 | if(p.y >= 1500 && p.y <= 3800) |
bhavk11 | 4:5b088ba4f1f1 | 353 | { |
bhavk11 | 4:5b088ba4f1f1 | 354 | //call |
bhavk11 | 4:5b088ba4f1f1 | 355 | cmd = "Call"; |
bhavk11 | 4:5b088ba4f1f1 | 356 | break; |
bhavk11 | 4:5b088ba4f1f1 | 357 | } |
bhavk11 | 4:5b088ba4f1f1 | 358 | else if(p.y >= 4500 && p.y <= 7100) |
bhavk11 | 4:5b088ba4f1f1 | 359 | { |
bhavk11 | 4:5b088ba4f1f1 | 360 | //text |
bhavk11 | 4:5b088ba4f1f1 | 361 | cmd = "Text"; |
bhavk11 | 4:5b088ba4f1f1 | 362 | break; |
bhavk11 | 4:5b088ba4f1f1 | 363 | } |
bhavk11 | 4:5b088ba4f1f1 | 364 | else |
bhavk11 | 4:5b088ba4f1f1 | 365 | {} |
bhavk11 | 4:5b088ba4f1f1 | 366 | |
bhavk11 | 4:5b088ba4f1f1 | 367 | } |
bhavk11 | 5:4add240cef16 | 368 | } |
bhavk11 | 5:4add240cef16 | 369 | else if(strcmp(cmd, "Ring") == 0 || strcmp(cmd, "RecvM") == 0) |
bhavk11 | 5:4add240cef16 | 370 | { |
bhavk11 | 5:4add240cef16 | 371 | break; |
bhavk11 | 5:4add240cef16 | 372 | } |
bhavk11 | 4:5b088ba4f1f1 | 373 | } |
bhavk11 | 4:5b088ba4f1f1 | 374 | |
bhavk11 | 4:5b088ba4f1f1 | 375 | if(strcmp(cmd, "Call") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 376 | { |
bhavk11 | 4:5b088ba4f1f1 | 377 | initKeypad(); |
bhavk11 | 4:5b088ba4f1f1 | 378 | printKey(130,280,"CALL","" ); |
bhavk11 | 4:5b088ba4f1f1 | 379 | point cursor; |
bhavk11 | 4:5b088ba4f1f1 | 380 | cursor.x = 0; |
bhavk11 | 4:5b088ba4f1f1 | 381 | cursor.y = 5; |
bhavk11 | 4:5b088ba4f1f1 | 382 | char buffer[140]; |
bhavk11 | 4:5b088ba4f1f1 | 383 | char *ptr = buffer; |
bhavk11 | 4:5b088ba4f1f1 | 384 | while(strcmp(cmd, "Call") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 385 | { |
bhavk11 | 4:5b088ba4f1f1 | 386 | TFT.foreground(Black); |
bhavk11 | 4:5b088ba4f1f1 | 387 | int key = getKey(); |
bhavk11 | 4:5b088ba4f1f1 | 388 | switch(key) |
bhavk11 | 4:5b088ba4f1f1 | 389 | { |
bhavk11 | 4:5b088ba4f1f1 | 390 | case 0: |
bhavk11 | 4:5b088ba4f1f1 | 391 | if(displayChar(cursor, '0')) { |
bhavk11 | 4:5b088ba4f1f1 | 392 | *ptr = '0'; |
bhavk11 | 4:5b088ba4f1f1 | 393 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 394 | } |
bhavk11 | 4:5b088ba4f1f1 | 395 | break; |
bhavk11 | 4:5b088ba4f1f1 | 396 | case 1: |
bhavk11 | 4:5b088ba4f1f1 | 397 | if(displayChar(cursor, '1')) { |
bhavk11 | 4:5b088ba4f1f1 | 398 | *ptr = '1'; |
bhavk11 | 4:5b088ba4f1f1 | 399 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 400 | } |
bhavk11 | 4:5b088ba4f1f1 | 401 | break; |
bhavk11 | 4:5b088ba4f1f1 | 402 | case 2: |
bhavk11 | 4:5b088ba4f1f1 | 403 | if(displayChar(cursor, '2')) { |
bhavk11 | 4:5b088ba4f1f1 | 404 | *ptr = '2'; |
bhavk11 | 4:5b088ba4f1f1 | 405 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 406 | } |
bhavk11 | 4:5b088ba4f1f1 | 407 | break; |
bhavk11 | 4:5b088ba4f1f1 | 408 | case 3: |
bhavk11 | 4:5b088ba4f1f1 | 409 | if(displayChar(cursor, '3')) { |
bhavk11 | 4:5b088ba4f1f1 | 410 | *ptr = '3'; |
bhavk11 | 4:5b088ba4f1f1 | 411 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 412 | } |
bhavk11 | 4:5b088ba4f1f1 | 413 | break; |
bhavk11 | 4:5b088ba4f1f1 | 414 | case 4: |
bhavk11 | 4:5b088ba4f1f1 | 415 | if(displayChar(cursor, '4')) { |
bhavk11 | 4:5b088ba4f1f1 | 416 | *ptr = '4'; |
bhavk11 | 4:5b088ba4f1f1 | 417 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 418 | } |
bhavk11 | 4:5b088ba4f1f1 | 419 | break; |
bhavk11 | 4:5b088ba4f1f1 | 420 | case 5: |
bhavk11 | 4:5b088ba4f1f1 | 421 | if(displayChar(cursor, '5')) { |
bhavk11 | 4:5b088ba4f1f1 | 422 | *ptr = '5'; |
bhavk11 | 4:5b088ba4f1f1 | 423 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 424 | } |
bhavk11 | 4:5b088ba4f1f1 | 425 | break; |
bhavk11 | 4:5b088ba4f1f1 | 426 | case 6: |
bhavk11 | 4:5b088ba4f1f1 | 427 | if(displayChar(cursor, '6')) { |
bhavk11 | 4:5b088ba4f1f1 | 428 | *ptr = '6'; |
bhavk11 | 4:5b088ba4f1f1 | 429 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 430 | } |
bhavk11 | 4:5b088ba4f1f1 | 431 | break; |
bhavk11 | 4:5b088ba4f1f1 | 432 | case 7: |
bhavk11 | 4:5b088ba4f1f1 | 433 | if(displayChar(cursor, '7')) { |
bhavk11 | 4:5b088ba4f1f1 | 434 | *ptr = '7'; |
bhavk11 | 4:5b088ba4f1f1 | 435 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 436 | } |
bhavk11 | 4:5b088ba4f1f1 | 437 | break; |
bhavk11 | 4:5b088ba4f1f1 | 438 | case 8: |
bhavk11 | 4:5b088ba4f1f1 | 439 | if(displayChar(cursor, '8')) { |
bhavk11 | 4:5b088ba4f1f1 | 440 | *ptr = '8'; |
bhavk11 | 4:5b088ba4f1f1 | 441 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 442 | } |
bhavk11 | 4:5b088ba4f1f1 | 443 | break; |
bhavk11 | 4:5b088ba4f1f1 | 444 | case 9: |
bhavk11 | 4:5b088ba4f1f1 | 445 | if(displayChar(cursor, '9')) { |
bhavk11 | 4:5b088ba4f1f1 | 446 | *ptr = '9'; |
bhavk11 | 4:5b088ba4f1f1 | 447 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 448 | } |
bhavk11 | 4:5b088ba4f1f1 | 449 | break; |
bhavk11 | 4:5b088ba4f1f1 | 450 | case 35: |
bhavk11 | 4:5b088ba4f1f1 | 451 | if(displayChar(cursor, '#')) { |
bhavk11 | 4:5b088ba4f1f1 | 452 | *ptr = '#'; |
bhavk11 | 4:5b088ba4f1f1 | 453 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 454 | } |
bhavk11 | 4:5b088ba4f1f1 | 455 | break; |
bhavk11 | 4:5b088ba4f1f1 | 456 | case 42: |
bhavk11 | 4:5b088ba4f1f1 | 457 | if(displayChar(cursor, '*')) { |
bhavk11 | 4:5b088ba4f1f1 | 458 | *ptr = '*'; |
bhavk11 | 4:5b088ba4f1f1 | 459 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 460 | } |
bhavk11 | 4:5b088ba4f1f1 | 461 | break; |
bhavk11 | 4:5b088ba4f1f1 | 462 | case 43: |
bhavk11 | 4:5b088ba4f1f1 | 463 | cmd = "Make"; |
bhavk11 | 4:5b088ba4f1f1 | 464 | break; |
bhavk11 | 4:5b088ba4f1f1 | 465 | case 60: |
bhavk11 | 4:5b088ba4f1f1 | 466 | cmd = "Back"; |
bhavk11 | 4:5b088ba4f1f1 | 467 | break; |
bhavk11 | 4:5b088ba4f1f1 | 468 | case 127: |
bhavk11 | 4:5b088ba4f1f1 | 469 | if(ptr > buffer) |
bhavk11 | 4:5b088ba4f1f1 | 470 | { |
bhavk11 | 4:5b088ba4f1f1 | 471 | ptr--; |
bhavk11 | 6:cd0294454118 | 472 | if(cursor.x - 12 >= 0) |
bhavk11 | 6:cd0294454118 | 473 | cursor.x -= 12; |
bhavk11 | 4:5b088ba4f1f1 | 474 | else |
bhavk11 | 4:5b088ba4f1f1 | 475 | { |
bhavk11 | 6:cd0294454118 | 476 | cursor.x = 240; |
bhavk11 | 4:5b088ba4f1f1 | 477 | if(cursor.y - 21 >= 5 ) |
bhavk11 | 4:5b088ba4f1f1 | 478 | cursor.y -= 21; |
bhavk11 | 4:5b088ba4f1f1 | 479 | } |
bhavk11 | 4:5b088ba4f1f1 | 480 | TFT.locate(cursor.x,cursor.y); |
bhavk11 | 4:5b088ba4f1f1 | 481 | TFT.printf(" "); |
bhavk11 | 4:5b088ba4f1f1 | 482 | } |
bhavk11 | 4:5b088ba4f1f1 | 483 | break; |
bhavk11 | 4:5b088ba4f1f1 | 484 | } |
bhavk11 | 4:5b088ba4f1f1 | 485 | } |
bhavk11 | 4:5b088ba4f1f1 | 486 | if(strcmp(cmd, "Make") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 487 | { |
bhavk11 | 4:5b088ba4f1f1 | 488 | TFT.background(Black); |
bhavk11 | 4:5b088ba4f1f1 | 489 | TFT.foreground(White); |
bhavk11 | 4:5b088ba4f1f1 | 490 | TFT.cls(); |
bhavk11 | 4:5b088ba4f1f1 | 491 | int i=0; |
bhavk11 | 4:5b088ba4f1f1 | 492 | cursor.x = 0; |
bhavk11 | 4:5b088ba4f1f1 | 493 | cursor.y = 5; |
bhavk11 | 4:5b088ba4f1f1 | 494 | TFT.locate(0,0); |
bhavk11 | 4:5b088ba4f1f1 | 495 | while(&buffer[i] < ptr) |
bhavk11 | 4:5b088ba4f1f1 | 496 | displayChar(cursor, buffer[i++]); |
bhavk11 | 4:5b088ba4f1f1 | 497 | TFT.line(0,270,240,270,Red); |
bhavk11 | 4:5b088ba4f1f1 | 498 | TFT.foreground(Red); |
bhavk11 | 4:5b088ba4f1f1 | 499 | TFT.locate(60,280); |
bhavk11 | 5:4add240cef16 | 500 | TFT.set_font((unsigned char*) Arial24x23); |
bhavk11 | 4:5b088ba4f1f1 | 501 | TFT.printf("Hang Up"); |
bhavk11 | 4:5b088ba4f1f1 | 502 | while(strcmp(cmd, "Make") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 503 | { |
bhavk11 | 4:5b088ba4f1f1 | 504 | if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250) |
bhavk11 | 4:5b088ba4f1f1 | 505 | cmd = "Back"; |
bhavk11 | 4:5b088ba4f1f1 | 506 | } |
bhavk11 | 4:5b088ba4f1f1 | 507 | } |
bhavk11 | 4:5b088ba4f1f1 | 508 | if(strcmp(cmd, "Back") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 509 | { |
bhavk11 | 4:5b088ba4f1f1 | 510 | //Home screen |
bhavk11 | 4:5b088ba4f1f1 | 511 | } |
bhavk11 | 4:5b088ba4f1f1 | 512 | } |
bhavk11 | 4:5b088ba4f1f1 | 513 | else if(strcmp(cmd, "Text") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 514 | { |
bhavk11 | 4:5b088ba4f1f1 | 515 | initKeypad(); |
bhavk11 | 4:5b088ba4f1f1 | 516 | printKey(130,280,"SEND","" ); |
bhavk11 | 4:5b088ba4f1f1 | 517 | point cursor; |
bhavk11 | 4:5b088ba4f1f1 | 518 | cursor.x = 0; |
bhavk11 | 4:5b088ba4f1f1 | 519 | cursor.y = 5; |
bhavk11 | 4:5b088ba4f1f1 | 520 | char buffer[140]; |
bhavk11 | 4:5b088ba4f1f1 | 521 | char *ptr = buffer; |
bhavk11 | 4:5b088ba4f1f1 | 522 | while(strcmp(cmd, "Text") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 523 | { |
bhavk11 | 6:cd0294454118 | 524 | int key = getAlpha(cursor, ptr); |
bhavk11 | 4:5b088ba4f1f1 | 525 | switch(key) |
bhavk11 | 4:5b088ba4f1f1 | 526 | { |
bhavk11 | 4:5b088ba4f1f1 | 527 | case 43: |
bhavk11 | 4:5b088ba4f1f1 | 528 | cmd = "Send"; |
bhavk11 | 4:5b088ba4f1f1 | 529 | break; |
bhavk11 | 4:5b088ba4f1f1 | 530 | case 60: |
bhavk11 | 4:5b088ba4f1f1 | 531 | cmd = "Back"; |
bhavk11 | 4:5b088ba4f1f1 | 532 | break; |
bhavk11 | 4:5b088ba4f1f1 | 533 | case 127: |
bhavk11 | 6:cd0294454118 | 534 | pc.printf("Backspace"); |
bhavk11 | 4:5b088ba4f1f1 | 535 | if(ptr > buffer) |
bhavk11 | 4:5b088ba4f1f1 | 536 | { |
bhavk11 | 4:5b088ba4f1f1 | 537 | ptr--; |
bhavk11 | 6:cd0294454118 | 538 | if(cursor.x - 12 >= 0) |
bhavk11 | 6:cd0294454118 | 539 | cursor.x -= 12; |
bhavk11 | 4:5b088ba4f1f1 | 540 | else |
bhavk11 | 4:5b088ba4f1f1 | 541 | { |
bhavk11 | 6:cd0294454118 | 542 | cursor.x = 240; |
bhavk11 | 4:5b088ba4f1f1 | 543 | if(cursor.y - 21 >= 5 ) |
bhavk11 | 4:5b088ba4f1f1 | 544 | cursor.y -= 21; |
bhavk11 | 4:5b088ba4f1f1 | 545 | } |
bhavk11 | 4:5b088ba4f1f1 | 546 | TFT.locate(cursor.x,cursor.y); |
bhavk11 | 4:5b088ba4f1f1 | 547 | TFT.printf(" "); |
bhavk11 | 4:5b088ba4f1f1 | 548 | } |
bhavk11 | 4:5b088ba4f1f1 | 549 | break; |
bhavk11 | 4:5b088ba4f1f1 | 550 | } |
bhavk11 | 4:5b088ba4f1f1 | 551 | } |
bhavk11 | 4:5b088ba4f1f1 | 552 | if(strcmp(cmd,"Send") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 553 | { |
bhavk11 | 4:5b088ba4f1f1 | 554 | TFT.background(Black); |
bhavk11 | 4:5b088ba4f1f1 | 555 | TFT.foreground(White); |
bhavk11 | 4:5b088ba4f1f1 | 556 | TFT.cls(); |
bhavk11 | 4:5b088ba4f1f1 | 557 | TFT.locate(90,60); |
bhavk11 | 4:5b088ba4f1f1 | 558 | TFT.printf("Text"); |
bhavk11 | 4:5b088ba4f1f1 | 559 | TFT.locate(90,95); |
bhavk11 | 4:5b088ba4f1f1 | 560 | TFT.printf("Sent!"); |
bhavk11 | 4:5b088ba4f1f1 | 561 | wait(2.5); |
bhavk11 | 4:5b088ba4f1f1 | 562 | cmd = "Back"; |
bhavk11 | 4:5b088ba4f1f1 | 563 | } |
bhavk11 | 4:5b088ba4f1f1 | 564 | } |
bhavk11 | 5:4add240cef16 | 565 | else if (strcmp(cmd, "Ring") == 0) |
bhavk11 | 5:4add240cef16 | 566 | { |
bhavk11 | 5:4add240cef16 | 567 | TFT.background(Black); |
bhavk11 | 5:4add240cef16 | 568 | TFT.foreground(White); |
bhavk11 | 5:4add240cef16 | 569 | TFT.cls(); |
bhavk11 | 5:4add240cef16 | 570 | TFT.locate(0,0); |
bhavk11 | 5:4add240cef16 | 571 | TFT.printf("Incoming Call..."); |
bhavk11 | 5:4add240cef16 | 572 | TFT.foreground(Green); |
bhavk11 | 5:4add240cef16 | 573 | TFT.set_font((unsigned char*) Arial24x23); |
bhavk11 | 5:4add240cef16 | 574 | TFT.locate(28,230); |
bhavk11 | 5:4add240cef16 | 575 | TFT.printf("ANS"); |
bhavk11 | 5:4add240cef16 | 576 | TFT.circle(60,240,50,Maroon); |
bhavk11 | 5:4add240cef16 | 577 | |
bhavk11 | 5:4add240cef16 | 578 | TFT.foreground(Red); |
bhavk11 | 5:4add240cef16 | 579 | TFT.locate(140,230); |
bhavk11 | 5:4add240cef16 | 580 | TFT.printf("HANG UP"); |
bhavk11 | 5:4add240cef16 | 581 | TFT.circle(180,240,50,Maroon); |
bhavk11 | 5:4add240cef16 | 582 | while(strcmp(cmd, "Make") == 0) |
bhavk11 | 5:4add240cef16 | 583 | { |
bhavk11 | 5:4add240cef16 | 584 | if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250) |
bhavk11 | 5:4add240cef16 | 585 | cmd = "Back"; |
bhavk11 | 5:4add240cef16 | 586 | } |
bhavk11 | 5:4add240cef16 | 587 | } |
bhavk11 | 5:4add240cef16 | 588 | else if(strcmp(cmd, "RecvM") == 0) |
bhavk11 | 5:4add240cef16 | 589 | { |
bhavk11 | 5:4add240cef16 | 590 | |
bhavk11 | 5:4add240cef16 | 591 | //display msg |
bhavk11 | 5:4add240cef16 | 592 | //back on button press |
bhavk11 | 5:4add240cef16 | 593 | } |
neilt6 | 0:407dafce805d | 594 | } |
neilt6 | 0:407dafce805d | 595 | } |