aaa
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
main.cpp@7:11eb2c8df6a9, 2014-10-25 (annotated)
- Committer:
- bhavk11
- Date:
- Sat Oct 25 18:33:48 2014 +0000
- Revision:
- 7:11eb2c8df6a9
- Parent:
- 6:cd0294454118
- Child:
- 8:5e8c0b37bcf9
asd
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 | 7:11eb2c8df6a9 | 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 | 7:11eb2c8df6a9 | 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 | 7:11eb2c8df6a9 | 202 | ptr = *pt; |
bhavk11 | 6:cd0294454118 | 203 | touchCount = count; |
bhavk11 | 7:11eb2c8df6a9 | 204 | START: |
bhavk11 | 6:cd0294454118 | 205 | switch(key) |
bhavk11 | 6:cd0294454118 | 206 | { |
bhavk11 | 6:cd0294454118 | 207 | case 0: |
bhavk11 | 6:cd0294454118 | 208 | touchCount = (touchCount-1)%(sizeof(ip0)/sizeof(ip0[0])); |
bhavk11 | 6:cd0294454118 | 209 | if(displayChar(cursor, ip0[touchCount])) { |
bhavk11 | 6:cd0294454118 | 210 | *ptr = ip0[touchCount]; |
bhavk11 | 6:cd0294454118 | 211 | ptr++; |
bhavk11 | 6:cd0294454118 | 212 | } |
bhavk11 | 6:cd0294454118 | 213 | break; |
bhavk11 | 6:cd0294454118 | 214 | case 1: |
bhavk11 | 6:cd0294454118 | 215 | if(displayChar(cursor, '1')) { |
bhavk11 | 6:cd0294454118 | 216 | *ptr = '1'; |
bhavk11 | 6:cd0294454118 | 217 | ptr++; |
bhavk11 | 6:cd0294454118 | 218 | } |
bhavk11 | 6:cd0294454118 | 219 | break; |
bhavk11 | 6:cd0294454118 | 220 | case 2: |
bhavk11 | 6:cd0294454118 | 221 | pc.printf("AAYA\r\n"); |
bhavk11 | 6:cd0294454118 | 222 | touchCount = (touchCount-1)%(sizeof(ip2)/sizeof(ip2[0])); |
bhavk11 | 6:cd0294454118 | 223 | if(displayChar(cursor, ip2[touchCount])) { |
bhavk11 | 6:cd0294454118 | 224 | *ptr = ip2[touchCount]; |
bhavk11 | 6:cd0294454118 | 225 | ptr++; |
bhavk11 | 6:cd0294454118 | 226 | } |
bhavk11 | 6:cd0294454118 | 227 | break; |
bhavk11 | 6:cd0294454118 | 228 | case 3: |
bhavk11 | 6:cd0294454118 | 229 | touchCount = (touchCount-1)%(sizeof(ip3)/sizeof(ip3[0])); |
bhavk11 | 6:cd0294454118 | 230 | if(displayChar(cursor, ip3[touchCount])) { |
bhavk11 | 6:cd0294454118 | 231 | *ptr = ip3[touchCount]; |
bhavk11 | 6:cd0294454118 | 232 | ptr++; |
bhavk11 | 6:cd0294454118 | 233 | } |
bhavk11 | 6:cd0294454118 | 234 | break; |
bhavk11 | 6:cd0294454118 | 235 | case 4: |
bhavk11 | 6:cd0294454118 | 236 | touchCount = (touchCount-1)%(sizeof(ip4)/sizeof(ip4[0])); |
bhavk11 | 6:cd0294454118 | 237 | if(displayChar(cursor, ip4[touchCount])) { |
bhavk11 | 6:cd0294454118 | 238 | *ptr = ip4[touchCount]; |
bhavk11 | 6:cd0294454118 | 239 | ptr++; |
bhavk11 | 6:cd0294454118 | 240 | } |
bhavk11 | 6:cd0294454118 | 241 | break; |
bhavk11 | 6:cd0294454118 | 242 | case 5: |
bhavk11 | 6:cd0294454118 | 243 | touchCount = (touchCount-1)%(sizeof(ip5)/sizeof(ip5[0])); |
bhavk11 | 6:cd0294454118 | 244 | if(displayChar(cursor, ip5[touchCount])) { |
bhavk11 | 6:cd0294454118 | 245 | *ptr = ip5[touchCount]; |
bhavk11 | 6:cd0294454118 | 246 | ptr++; |
bhavk11 | 6:cd0294454118 | 247 | } |
bhavk11 | 6:cd0294454118 | 248 | break; |
bhavk11 | 6:cd0294454118 | 249 | case 6: |
bhavk11 | 6:cd0294454118 | 250 | touchCount = (touchCount-1)%(sizeof(ip6)/sizeof(ip6[0])); |
bhavk11 | 6:cd0294454118 | 251 | if(displayChar(cursor, ip6[touchCount])) { |
bhavk11 | 6:cd0294454118 | 252 | *ptr = ip6[touchCount]; |
bhavk11 | 6:cd0294454118 | 253 | ptr++; |
bhavk11 | 6:cd0294454118 | 254 | } |
bhavk11 | 6:cd0294454118 | 255 | break; |
bhavk11 | 6:cd0294454118 | 256 | case 7: |
bhavk11 | 6:cd0294454118 | 257 | touchCount = (touchCount-1)%(sizeof(ip7)/sizeof(ip7[0])); |
bhavk11 | 6:cd0294454118 | 258 | if(displayChar(cursor, ip7[touchCount])) { |
bhavk11 | 6:cd0294454118 | 259 | *ptr = ip7[touchCount]; |
bhavk11 | 6:cd0294454118 | 260 | ptr++; |
bhavk11 | 6:cd0294454118 | 261 | } |
bhavk11 | 6:cd0294454118 | 262 | break; |
bhavk11 | 6:cd0294454118 | 263 | case 8: |
bhavk11 | 6:cd0294454118 | 264 | touchCount = (touchCount-1)%(sizeof(ip8)/sizeof(ip8[0])); |
bhavk11 | 6:cd0294454118 | 265 | if(displayChar(cursor, ip8[touchCount])) { |
bhavk11 | 6:cd0294454118 | 266 | *ptr = ip8[touchCount]; |
bhavk11 | 6:cd0294454118 | 267 | ptr++; |
bhavk11 | 6:cd0294454118 | 268 | } |
bhavk11 | 6:cd0294454118 | 269 | break; |
bhavk11 | 6:cd0294454118 | 270 | case 9: |
bhavk11 | 6:cd0294454118 | 271 | touchCount = (touchCount-1)%(sizeof(ip9)/sizeof(ip9[0])); |
bhavk11 | 6:cd0294454118 | 272 | if(displayChar(cursor, ip9[touchCount])) { |
bhavk11 | 6:cd0294454118 | 273 | *ptr = ip9[touchCount]; |
bhavk11 | 6:cd0294454118 | 274 | ptr++; |
bhavk11 | 6:cd0294454118 | 275 | } |
bhavk11 | 6:cd0294454118 | 276 | break; |
bhavk11 | 6:cd0294454118 | 277 | case 35: |
bhavk11 | 6:cd0294454118 | 278 | if(displayChar(cursor, '#')) { |
bhavk11 | 6:cd0294454118 | 279 | *ptr = '#'; |
bhavk11 | 6:cd0294454118 | 280 | ptr++; |
bhavk11 | 6:cd0294454118 | 281 | } |
bhavk11 | 6:cd0294454118 | 282 | break; |
bhavk11 | 6:cd0294454118 | 283 | case 42: |
bhavk11 | 6:cd0294454118 | 284 | if(displayChar(cursor, '*')) { |
bhavk11 | 6:cd0294454118 | 285 | *ptr = '*'; |
bhavk11 | 6:cd0294454118 | 286 | ptr++; |
bhavk11 | 6:cd0294454118 | 287 | } |
bhavk11 | 6:cd0294454118 | 288 | break; |
bhavk11 | 6:cd0294454118 | 289 | } |
bhavk11 | 6:cd0294454118 | 290 | |
bhavk11 | 6:cd0294454118 | 291 | key = getKey(); |
bhavk11 | 6:cd0294454118 | 292 | end = t.read_ms(); |
bhavk11 | 7:11eb2c8df6a9 | 293 | if(key == -1) goto START; |
bhavk11 | 6:cd0294454118 | 294 | |
bhavk11 | 6:cd0294454118 | 295 | if(!(prevKey == key)){ |
bhavk11 | 6:cd0294454118 | 296 | break; |
bhavk11 | 6:cd0294454118 | 297 | } |
bhavk11 | 6:cd0294454118 | 298 | count++; |
bhavk11 | 6:cd0294454118 | 299 | |
bhavk11 | 6:cd0294454118 | 300 | pc.printf("ok curr count :%d key : %d prev_key : %d \r\n", touchCount,key, prevKey); |
bhavk11 | 6:cd0294454118 | 301 | } |
bhavk11 | 6:cd0294454118 | 302 | t.stop(); |
bhavk11 | 6:cd0294454118 | 303 | pc.printf("ok count is :%d \r\n", touchCount); |
bhavk11 | 7:11eb2c8df6a9 | 304 | pc.printf("PTR: %x, PT: %x\r\n",ptr,*pt); |
bhavk11 | 7:11eb2c8df6a9 | 305 | /*if(cursor.x + 12 <= 228) |
bhavk11 | 6:cd0294454118 | 306 | cursor.x += 12; |
bhavk11 | 6:cd0294454118 | 307 | else |
bhavk11 | 6:cd0294454118 | 308 | { |
bhavk11 | 6:cd0294454118 | 309 | cursor.x = 0; |
bhavk11 | 6:cd0294454118 | 310 | if(cursor.y + 21 <= 65 ) |
bhavk11 | 6:cd0294454118 | 311 | cursor.y += 21; |
bhavk11 | 7:11eb2c8df6a9 | 312 | }*/ |
bhavk11 | 6:cd0294454118 | 313 | |
bhavk11 | 6:cd0294454118 | 314 | x = cursor; |
bhavk11 | 7:11eb2c8df6a9 | 315 | *pt = ptr; |
bhavk11 | 6:cd0294454118 | 316 | return prevKey; |
bhavk11 | 6:cd0294454118 | 317 | } |
bhavk11 | 6:cd0294454118 | 318 | |
neilt6 | 0:407dafce805d | 319 | int main() |
neilt6 | 0:407dafce805d | 320 | { |
bhavk11 | 4:5b088ba4f1f1 | 321 | point p; |
bhavk11 | 4:5b088ba4f1f1 | 322 | char* cmd = NULL; |
neilt6 | 0:407dafce805d | 323 | //Configure the display driver |
neilt6 | 0:407dafce805d | 324 | TFT.background(Black); |
neilt6 | 0:407dafce805d | 325 | TFT.foreground(White); |
neilt6 | 0:407dafce805d | 326 | TFT.cls(); |
neilt6 | 0:407dafce805d | 327 | |
bhavk11 | 4:5b088ba4f1f1 | 328 | while(true) |
bhavk11 | 4:5b088ba4f1f1 | 329 | { |
bhavk11 | 4:5b088ba4f1f1 | 330 | //Print a welcome message |
bhavk11 | 4:5b088ba4f1f1 | 331 | TFT.background(White); |
bhavk11 | 4:5b088ba4f1f1 | 332 | TFT.set_font((unsigned char*) Neu42x35); |
bhavk11 | 4:5b088ba4f1f1 | 333 | TFT.foreground(Maroon); |
bhavk11 | 4:5b088ba4f1f1 | 334 | TFT.cls(); |
bhavk11 | 4:5b088ba4f1f1 | 335 | TFT.locate(100,60); |
bhavk11 | 4:5b088ba4f1f1 | 336 | TFT.printf("IU"); |
bhavk11 | 4:5b088ba4f1f1 | 337 | |
bhavk11 | 4:5b088ba4f1f1 | 338 | TFT.set_font((unsigned char*) Arial24x23); |
bhavk11 | 4:5b088ba4f1f1 | 339 | TFT.locate(28,230); |
bhavk11 | 4:5b088ba4f1f1 | 340 | TFT.printf("CALL"); |
bhavk11 | 4:5b088ba4f1f1 | 341 | TFT.circle(60,240,50,Maroon); |
bhavk11 | 4:5b088ba4f1f1 | 342 | |
bhavk11 | 4:5b088ba4f1f1 | 343 | TFT.locate(140,230); |
bhavk11 | 4:5b088ba4f1f1 | 344 | TFT.printf("TEXT"); |
bhavk11 | 4:5b088ba4f1f1 | 345 | TFT.circle(180,240,50,Maroon); |
bhavk11 | 4:5b088ba4f1f1 | 346 | |
bhavk11 | 4:5b088ba4f1f1 | 347 | while(true) |
bhavk11 | 4:5b088ba4f1f1 | 348 | { |
bhavk11 | 4:5b088ba4f1f1 | 349 | if (TFT.getTouch(p) == TFT.YES) |
bhavk11 | 4:5b088ba4f1f1 | 350 | { |
bhavk11 | 4:5b088ba4f1f1 | 351 | if(p.x >= 4500 && p.x <= 6600) |
bhavk11 | 4:5b088ba4f1f1 | 352 | { |
bhavk11 | 4:5b088ba4f1f1 | 353 | if(p.y >= 1500 && p.y <= 3800) |
bhavk11 | 4:5b088ba4f1f1 | 354 | { |
bhavk11 | 4:5b088ba4f1f1 | 355 | //call |
bhavk11 | 4:5b088ba4f1f1 | 356 | cmd = "Call"; |
bhavk11 | 4:5b088ba4f1f1 | 357 | break; |
bhavk11 | 4:5b088ba4f1f1 | 358 | } |
bhavk11 | 4:5b088ba4f1f1 | 359 | else if(p.y >= 4500 && p.y <= 7100) |
bhavk11 | 4:5b088ba4f1f1 | 360 | { |
bhavk11 | 4:5b088ba4f1f1 | 361 | //text |
bhavk11 | 4:5b088ba4f1f1 | 362 | cmd = "Text"; |
bhavk11 | 4:5b088ba4f1f1 | 363 | break; |
bhavk11 | 4:5b088ba4f1f1 | 364 | } |
bhavk11 | 4:5b088ba4f1f1 | 365 | else |
bhavk11 | 4:5b088ba4f1f1 | 366 | {} |
bhavk11 | 4:5b088ba4f1f1 | 367 | |
bhavk11 | 4:5b088ba4f1f1 | 368 | } |
bhavk11 | 5:4add240cef16 | 369 | } |
bhavk11 | 5:4add240cef16 | 370 | else if(strcmp(cmd, "Ring") == 0 || strcmp(cmd, "RecvM") == 0) |
bhavk11 | 5:4add240cef16 | 371 | { |
bhavk11 | 5:4add240cef16 | 372 | break; |
bhavk11 | 5:4add240cef16 | 373 | } |
bhavk11 | 4:5b088ba4f1f1 | 374 | } |
bhavk11 | 4:5b088ba4f1f1 | 375 | |
bhavk11 | 4:5b088ba4f1f1 | 376 | if(strcmp(cmd, "Call") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 377 | { |
bhavk11 | 4:5b088ba4f1f1 | 378 | initKeypad(); |
bhavk11 | 4:5b088ba4f1f1 | 379 | printKey(130,280,"CALL","" ); |
bhavk11 | 4:5b088ba4f1f1 | 380 | point cursor; |
bhavk11 | 4:5b088ba4f1f1 | 381 | cursor.x = 0; |
bhavk11 | 4:5b088ba4f1f1 | 382 | cursor.y = 5; |
bhavk11 | 4:5b088ba4f1f1 | 383 | char buffer[140]; |
bhavk11 | 4:5b088ba4f1f1 | 384 | char *ptr = buffer; |
bhavk11 | 4:5b088ba4f1f1 | 385 | while(strcmp(cmd, "Call") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 386 | { |
bhavk11 | 4:5b088ba4f1f1 | 387 | TFT.foreground(Black); |
bhavk11 | 4:5b088ba4f1f1 | 388 | int key = getKey(); |
bhavk11 | 4:5b088ba4f1f1 | 389 | switch(key) |
bhavk11 | 4:5b088ba4f1f1 | 390 | { |
bhavk11 | 4:5b088ba4f1f1 | 391 | case 0: |
bhavk11 | 4:5b088ba4f1f1 | 392 | if(displayChar(cursor, '0')) { |
bhavk11 | 4:5b088ba4f1f1 | 393 | *ptr = '0'; |
bhavk11 | 4:5b088ba4f1f1 | 394 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 395 | } |
bhavk11 | 4:5b088ba4f1f1 | 396 | break; |
bhavk11 | 4:5b088ba4f1f1 | 397 | case 1: |
bhavk11 | 4:5b088ba4f1f1 | 398 | if(displayChar(cursor, '1')) { |
bhavk11 | 4:5b088ba4f1f1 | 399 | *ptr = '1'; |
bhavk11 | 4:5b088ba4f1f1 | 400 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 401 | } |
bhavk11 | 4:5b088ba4f1f1 | 402 | break; |
bhavk11 | 4:5b088ba4f1f1 | 403 | case 2: |
bhavk11 | 4:5b088ba4f1f1 | 404 | if(displayChar(cursor, '2')) { |
bhavk11 | 4:5b088ba4f1f1 | 405 | *ptr = '2'; |
bhavk11 | 4:5b088ba4f1f1 | 406 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 407 | } |
bhavk11 | 4:5b088ba4f1f1 | 408 | break; |
bhavk11 | 4:5b088ba4f1f1 | 409 | case 3: |
bhavk11 | 4:5b088ba4f1f1 | 410 | if(displayChar(cursor, '3')) { |
bhavk11 | 4:5b088ba4f1f1 | 411 | *ptr = '3'; |
bhavk11 | 4:5b088ba4f1f1 | 412 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 413 | } |
bhavk11 | 4:5b088ba4f1f1 | 414 | break; |
bhavk11 | 4:5b088ba4f1f1 | 415 | case 4: |
bhavk11 | 4:5b088ba4f1f1 | 416 | if(displayChar(cursor, '4')) { |
bhavk11 | 4:5b088ba4f1f1 | 417 | *ptr = '4'; |
bhavk11 | 4:5b088ba4f1f1 | 418 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 419 | } |
bhavk11 | 4:5b088ba4f1f1 | 420 | break; |
bhavk11 | 4:5b088ba4f1f1 | 421 | case 5: |
bhavk11 | 4:5b088ba4f1f1 | 422 | if(displayChar(cursor, '5')) { |
bhavk11 | 4:5b088ba4f1f1 | 423 | *ptr = '5'; |
bhavk11 | 4:5b088ba4f1f1 | 424 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 425 | } |
bhavk11 | 4:5b088ba4f1f1 | 426 | break; |
bhavk11 | 4:5b088ba4f1f1 | 427 | case 6: |
bhavk11 | 4:5b088ba4f1f1 | 428 | if(displayChar(cursor, '6')) { |
bhavk11 | 4:5b088ba4f1f1 | 429 | *ptr = '6'; |
bhavk11 | 4:5b088ba4f1f1 | 430 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 431 | } |
bhavk11 | 4:5b088ba4f1f1 | 432 | break; |
bhavk11 | 4:5b088ba4f1f1 | 433 | case 7: |
bhavk11 | 4:5b088ba4f1f1 | 434 | if(displayChar(cursor, '7')) { |
bhavk11 | 4:5b088ba4f1f1 | 435 | *ptr = '7'; |
bhavk11 | 4:5b088ba4f1f1 | 436 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 437 | } |
bhavk11 | 4:5b088ba4f1f1 | 438 | break; |
bhavk11 | 4:5b088ba4f1f1 | 439 | case 8: |
bhavk11 | 4:5b088ba4f1f1 | 440 | if(displayChar(cursor, '8')) { |
bhavk11 | 4:5b088ba4f1f1 | 441 | *ptr = '8'; |
bhavk11 | 4:5b088ba4f1f1 | 442 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 443 | } |
bhavk11 | 4:5b088ba4f1f1 | 444 | break; |
bhavk11 | 4:5b088ba4f1f1 | 445 | case 9: |
bhavk11 | 4:5b088ba4f1f1 | 446 | if(displayChar(cursor, '9')) { |
bhavk11 | 4:5b088ba4f1f1 | 447 | *ptr = '9'; |
bhavk11 | 4:5b088ba4f1f1 | 448 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 449 | } |
bhavk11 | 4:5b088ba4f1f1 | 450 | break; |
bhavk11 | 4:5b088ba4f1f1 | 451 | case 35: |
bhavk11 | 4:5b088ba4f1f1 | 452 | if(displayChar(cursor, '#')) { |
bhavk11 | 4:5b088ba4f1f1 | 453 | *ptr = '#'; |
bhavk11 | 4:5b088ba4f1f1 | 454 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 455 | } |
bhavk11 | 4:5b088ba4f1f1 | 456 | break; |
bhavk11 | 4:5b088ba4f1f1 | 457 | case 42: |
bhavk11 | 4:5b088ba4f1f1 | 458 | if(displayChar(cursor, '*')) { |
bhavk11 | 4:5b088ba4f1f1 | 459 | *ptr = '*'; |
bhavk11 | 4:5b088ba4f1f1 | 460 | ptr++; |
bhavk11 | 4:5b088ba4f1f1 | 461 | } |
bhavk11 | 4:5b088ba4f1f1 | 462 | break; |
bhavk11 | 4:5b088ba4f1f1 | 463 | case 43: |
bhavk11 | 4:5b088ba4f1f1 | 464 | cmd = "Make"; |
bhavk11 | 4:5b088ba4f1f1 | 465 | break; |
bhavk11 | 4:5b088ba4f1f1 | 466 | case 60: |
bhavk11 | 4:5b088ba4f1f1 | 467 | cmd = "Back"; |
bhavk11 | 4:5b088ba4f1f1 | 468 | break; |
bhavk11 | 4:5b088ba4f1f1 | 469 | case 127: |
bhavk11 | 4:5b088ba4f1f1 | 470 | if(ptr > buffer) |
bhavk11 | 4:5b088ba4f1f1 | 471 | { |
bhavk11 | 4:5b088ba4f1f1 | 472 | ptr--; |
bhavk11 | 6:cd0294454118 | 473 | if(cursor.x - 12 >= 0) |
bhavk11 | 6:cd0294454118 | 474 | cursor.x -= 12; |
bhavk11 | 4:5b088ba4f1f1 | 475 | else |
bhavk11 | 4:5b088ba4f1f1 | 476 | { |
bhavk11 | 6:cd0294454118 | 477 | cursor.x = 240; |
bhavk11 | 4:5b088ba4f1f1 | 478 | if(cursor.y - 21 >= 5 ) |
bhavk11 | 4:5b088ba4f1f1 | 479 | cursor.y -= 21; |
bhavk11 | 4:5b088ba4f1f1 | 480 | } |
bhavk11 | 4:5b088ba4f1f1 | 481 | TFT.locate(cursor.x,cursor.y); |
bhavk11 | 4:5b088ba4f1f1 | 482 | TFT.printf(" "); |
bhavk11 | 4:5b088ba4f1f1 | 483 | } |
bhavk11 | 4:5b088ba4f1f1 | 484 | break; |
bhavk11 | 4:5b088ba4f1f1 | 485 | } |
bhavk11 | 4:5b088ba4f1f1 | 486 | } |
bhavk11 | 4:5b088ba4f1f1 | 487 | if(strcmp(cmd, "Make") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 488 | { |
bhavk11 | 4:5b088ba4f1f1 | 489 | TFT.background(Black); |
bhavk11 | 4:5b088ba4f1f1 | 490 | TFT.foreground(White); |
bhavk11 | 4:5b088ba4f1f1 | 491 | TFT.cls(); |
bhavk11 | 4:5b088ba4f1f1 | 492 | int i=0; |
bhavk11 | 4:5b088ba4f1f1 | 493 | cursor.x = 0; |
bhavk11 | 4:5b088ba4f1f1 | 494 | cursor.y = 5; |
bhavk11 | 4:5b088ba4f1f1 | 495 | TFT.locate(0,0); |
bhavk11 | 4:5b088ba4f1f1 | 496 | while(&buffer[i] < ptr) |
bhavk11 | 4:5b088ba4f1f1 | 497 | displayChar(cursor, buffer[i++]); |
bhavk11 | 4:5b088ba4f1f1 | 498 | TFT.line(0,270,240,270,Red); |
bhavk11 | 4:5b088ba4f1f1 | 499 | TFT.foreground(Red); |
bhavk11 | 4:5b088ba4f1f1 | 500 | TFT.locate(60,280); |
bhavk11 | 5:4add240cef16 | 501 | TFT.set_font((unsigned char*) Arial24x23); |
bhavk11 | 4:5b088ba4f1f1 | 502 | TFT.printf("Hang Up"); |
bhavk11 | 4:5b088ba4f1f1 | 503 | while(strcmp(cmd, "Make") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 504 | { |
bhavk11 | 4:5b088ba4f1f1 | 505 | if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250) |
bhavk11 | 4:5b088ba4f1f1 | 506 | cmd = "Back"; |
bhavk11 | 4:5b088ba4f1f1 | 507 | } |
bhavk11 | 4:5b088ba4f1f1 | 508 | } |
bhavk11 | 4:5b088ba4f1f1 | 509 | if(strcmp(cmd, "Back") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 510 | { |
bhavk11 | 4:5b088ba4f1f1 | 511 | //Home screen |
bhavk11 | 4:5b088ba4f1f1 | 512 | } |
bhavk11 | 4:5b088ba4f1f1 | 513 | } |
bhavk11 | 4:5b088ba4f1f1 | 514 | else if(strcmp(cmd, "Text") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 515 | { |
bhavk11 | 4:5b088ba4f1f1 | 516 | initKeypad(); |
bhavk11 | 4:5b088ba4f1f1 | 517 | printKey(130,280,"SEND","" ); |
bhavk11 | 4:5b088ba4f1f1 | 518 | point cursor; |
bhavk11 | 4:5b088ba4f1f1 | 519 | cursor.x = 0; |
bhavk11 | 4:5b088ba4f1f1 | 520 | cursor.y = 5; |
bhavk11 | 4:5b088ba4f1f1 | 521 | char buffer[140]; |
bhavk11 | 4:5b088ba4f1f1 | 522 | char *ptr = buffer; |
bhavk11 | 4:5b088ba4f1f1 | 523 | while(strcmp(cmd, "Text") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 524 | { |
bhavk11 | 7:11eb2c8df6a9 | 525 | int key = getAlpha(cursor, &ptr); |
bhavk11 | 4:5b088ba4f1f1 | 526 | switch(key) |
bhavk11 | 4:5b088ba4f1f1 | 527 | { |
bhavk11 | 4:5b088ba4f1f1 | 528 | case 43: |
bhavk11 | 4:5b088ba4f1f1 | 529 | cmd = "Send"; |
bhavk11 | 4:5b088ba4f1f1 | 530 | break; |
bhavk11 | 4:5b088ba4f1f1 | 531 | case 60: |
bhavk11 | 4:5b088ba4f1f1 | 532 | cmd = "Back"; |
bhavk11 | 4:5b088ba4f1f1 | 533 | break; |
bhavk11 | 4:5b088ba4f1f1 | 534 | case 127: |
bhavk11 | 7:11eb2c8df6a9 | 535 | pc.printf("PTR: %x, Buff: %x, Buffer: %s\r\n",ptr, &buffer[0], buffer); |
bhavk11 | 7:11eb2c8df6a9 | 536 | |
bhavk11 | 4:5b088ba4f1f1 | 537 | if(ptr > buffer) |
bhavk11 | 4:5b088ba4f1f1 | 538 | { |
bhavk11 | 7:11eb2c8df6a9 | 539 | pc.printf("true"); |
bhavk11 | 4:5b088ba4f1f1 | 540 | ptr--; |
bhavk11 | 6:cd0294454118 | 541 | if(cursor.x - 12 >= 0) |
bhavk11 | 6:cd0294454118 | 542 | cursor.x -= 12; |
bhavk11 | 4:5b088ba4f1f1 | 543 | else |
bhavk11 | 4:5b088ba4f1f1 | 544 | { |
bhavk11 | 6:cd0294454118 | 545 | cursor.x = 240; |
bhavk11 | 4:5b088ba4f1f1 | 546 | if(cursor.y - 21 >= 5 ) |
bhavk11 | 4:5b088ba4f1f1 | 547 | cursor.y -= 21; |
bhavk11 | 4:5b088ba4f1f1 | 548 | } |
bhavk11 | 4:5b088ba4f1f1 | 549 | TFT.locate(cursor.x,cursor.y); |
bhavk11 | 4:5b088ba4f1f1 | 550 | TFT.printf(" "); |
bhavk11 | 4:5b088ba4f1f1 | 551 | } |
bhavk11 | 4:5b088ba4f1f1 | 552 | break; |
bhavk11 | 4:5b088ba4f1f1 | 553 | } |
bhavk11 | 4:5b088ba4f1f1 | 554 | } |
bhavk11 | 4:5b088ba4f1f1 | 555 | if(strcmp(cmd,"Send") == 0) |
bhavk11 | 4:5b088ba4f1f1 | 556 | { |
bhavk11 | 4:5b088ba4f1f1 | 557 | TFT.background(Black); |
bhavk11 | 4:5b088ba4f1f1 | 558 | TFT.foreground(White); |
bhavk11 | 4:5b088ba4f1f1 | 559 | TFT.cls(); |
bhavk11 | 4:5b088ba4f1f1 | 560 | TFT.locate(90,60); |
bhavk11 | 4:5b088ba4f1f1 | 561 | TFT.printf("Text"); |
bhavk11 | 4:5b088ba4f1f1 | 562 | TFT.locate(90,95); |
bhavk11 | 4:5b088ba4f1f1 | 563 | TFT.printf("Sent!"); |
bhavk11 | 4:5b088ba4f1f1 | 564 | wait(2.5); |
bhavk11 | 4:5b088ba4f1f1 | 565 | cmd = "Back"; |
bhavk11 | 4:5b088ba4f1f1 | 566 | } |
bhavk11 | 4:5b088ba4f1f1 | 567 | } |
bhavk11 | 5:4add240cef16 | 568 | else if (strcmp(cmd, "Ring") == 0) |
bhavk11 | 5:4add240cef16 | 569 | { |
bhavk11 | 5:4add240cef16 | 570 | TFT.background(Black); |
bhavk11 | 5:4add240cef16 | 571 | TFT.foreground(White); |
bhavk11 | 5:4add240cef16 | 572 | TFT.cls(); |
bhavk11 | 5:4add240cef16 | 573 | TFT.locate(0,0); |
bhavk11 | 5:4add240cef16 | 574 | TFT.printf("Incoming Call..."); |
bhavk11 | 5:4add240cef16 | 575 | TFT.foreground(Green); |
bhavk11 | 5:4add240cef16 | 576 | TFT.set_font((unsigned char*) Arial24x23); |
bhavk11 | 5:4add240cef16 | 577 | TFT.locate(28,230); |
bhavk11 | 5:4add240cef16 | 578 | TFT.printf("ANS"); |
bhavk11 | 5:4add240cef16 | 579 | TFT.circle(60,240,50,Maroon); |
bhavk11 | 5:4add240cef16 | 580 | |
bhavk11 | 5:4add240cef16 | 581 | TFT.foreground(Red); |
bhavk11 | 5:4add240cef16 | 582 | TFT.locate(140,230); |
bhavk11 | 5:4add240cef16 | 583 | TFT.printf("HANG UP"); |
bhavk11 | 5:4add240cef16 | 584 | TFT.circle(180,240,50,Maroon); |
bhavk11 | 5:4add240cef16 | 585 | while(strcmp(cmd, "Make") == 0) |
bhavk11 | 5:4add240cef16 | 586 | { |
bhavk11 | 5:4add240cef16 | 587 | if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250) |
bhavk11 | 5:4add240cef16 | 588 | cmd = "Back"; |
bhavk11 | 5:4add240cef16 | 589 | } |
bhavk11 | 5:4add240cef16 | 590 | } |
bhavk11 | 5:4add240cef16 | 591 | else if(strcmp(cmd, "RecvM") == 0) |
bhavk11 | 5:4add240cef16 | 592 | { |
bhavk11 | 5:4add240cef16 | 593 | |
bhavk11 | 5:4add240cef16 | 594 | //display msg |
bhavk11 | 5:4add240cef16 | 595 | //back on button press |
bhavk11 | 5:4add240cef16 | 596 | } |
neilt6 | 0:407dafce805d | 597 | } |
neilt6 | 0:407dafce805d | 598 | } |