aaaa

Dependencies:   SeeedStudioTFTv2 TFT_fonts mbed

Fork of Seeed_TFT_Touch_Shield by Bhavik Bhuta

Committer:
uswickra
Date:
Sat Oct 25 23:43:01 2014 +0000
Revision:
10:5ea126441b8a
Parent:
9:f226caed4c66
Child:
11:575dfd388778
working call/ans

Who changed what in which revision?

UserRevisionLine numberNew 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);
uswickra 5:c1af1f8fa026 45 #define PHONE_NUMBER "+13174806512"
uswickra 5:c1af1f8fa026 46 #include "Modem.h"
uswickra 5:c1af1f8fa026 47
uswickra 5:c1af1f8fa026 48 Modem gsm (D10, D2, 19200, PHONE_NUMBER);
uswickra 5:c1af1f8fa026 49 DigitalOut modem_power(D9);
uswickra 5:c1af1f8fa026 50 char* cmd = NULL;
uswickra 7:5cf5aeae1954 51 int type = 0 ;
uswickra 10:5ea126441b8a 52 int int_state = 1 ;
uswickra 5:c1af1f8fa026 53
uswickra 7:5cf5aeae1954 54 void rxCallback() {
uswickra 7:5cf5aeae1954 55 //__disable_irq();
uswickra 7:5cf5aeae1954 56 if(gsm.serial_modem.readable()){
uswickra 7:5cf5aeae1954 57 char c = gsm.serial_modem.getc();
uswickra 7:5cf5aeae1954 58 type = gsm.updateBuffer(c);
uswickra 7:5cf5aeae1954 59 // pc.putc(c);
uswickra 10:5ea126441b8a 60 if(int_state == 1 && type == MESSAGE_RING){
uswickra 7:5cf5aeae1954 61 // pc.putc('R');
uswickra 7:5cf5aeae1954 62 cmd = "Ring" ;
uswickra 10:5ea126441b8a 63 int_state = 0 ;
uswickra 10:5ea126441b8a 64 // TFT.printf(cmd);
uswickra 7:5cf5aeae1954 65 }
uswickra 10:5ea126441b8a 66 if(int_state == 1 && type == MESSAGE_SMS){
uswickra 7:5cf5aeae1954 67 // pc.putc('S');
uswickra 7:5cf5aeae1954 68 }
uswickra 7:5cf5aeae1954 69
uswickra 7:5cf5aeae1954 70 }
uswickra 7:5cf5aeae1954 71 //__enable_irq();
uswickra 5:c1af1f8fa026 72 }
uswickra 5:c1af1f8fa026 73
neilt6 0:407dafce805d 74
bhavk11 4:5b088ba4f1f1 75 void printKey(int x, int y, char* digit, char* alphas)
bhavk11 4:5b088ba4f1f1 76 {
bhavk11 4:5b088ba4f1f1 77 TFT.foreground(Blue);
bhavk11 4:5b088ba4f1f1 78 TFT.set_font((unsigned char*) Arial24x23);
bhavk11 4:5b088ba4f1f1 79 TFT.locate(x,y);
bhavk11 4:5b088ba4f1f1 80 TFT.printf(digit);
bhavk11 4:5b088ba4f1f1 81 TFT.foreground(Black);
bhavk11 4:5b088ba4f1f1 82 TFT.set_font((unsigned char*) Arial12x12);
bhavk11 4:5b088ba4f1f1 83 TFT.locate(x+15,y+10);
bhavk11 4:5b088ba4f1f1 84 TFT.printf(alphas);
bhavk11 4:5b088ba4f1f1 85 }
bhavk11 4:5b088ba4f1f1 86
bhavk11 4:5b088ba4f1f1 87 void initKeypad()
bhavk11 4:5b088ba4f1f1 88 {
bhavk11 4:5b088ba4f1f1 89 TFT.background(White);
bhavk11 4:5b088ba4f1f1 90 TFT.cls();
bhavk11 4:5b088ba4f1f1 91 TFT.foreground(Black);
bhavk11 4:5b088ba4f1f1 92 TFT.set_font((unsigned char*) Arial12x12);
bhavk11 4:5b088ba4f1f1 93 TFT.locate(210,84);
bhavk11 4:5b088ba4f1f1 94 TFT.printf("Del");
bhavk11 4:5b088ba4f1f1 95 TFT.line(0,100,240,100,Black);
bhavk11 4:5b088ba4f1f1 96 TFT.rect(205,80,235,95,Black);
bhavk11 4:5b088ba4f1f1 97 TFT.line(205,80,195,95,White);
bhavk11 4:5b088ba4f1f1 98 TFT.line(192,87,205,80,Black);
bhavk11 4:5b088ba4f1f1 99 TFT.line(192,87,205,95,Black);
bhavk11 4:5b088ba4f1f1 100 printKey(20,120,"1"," ");
bhavk11 4:5b088ba4f1f1 101 printKey(95,120,"2","ABC");
bhavk11 4:5b088ba4f1f1 102 printKey(170,120,"3","DEF");
bhavk11 4:5b088ba4f1f1 103 printKey(20,160,"4","GHI");
bhavk11 4:5b088ba4f1f1 104 printKey(95,160,"5","JKL");
bhavk11 4:5b088ba4f1f1 105 printKey(170,160,"6","MNO");
bhavk11 4:5b088ba4f1f1 106 printKey(20,200,"7","PQRS");
bhavk11 4:5b088ba4f1f1 107 printKey(95,200,"8","TUV");
bhavk11 4:5b088ba4f1f1 108 printKey(170,200,"9","WXYZ");
bhavk11 4:5b088ba4f1f1 109 printKey(20,240,"*","");
bhavk11 4:5b088ba4f1f1 110 printKey(95,240,"0","+");
bhavk11 4:5b088ba4f1f1 111 printKey(170,240,"#","");
bhavk11 4:5b088ba4f1f1 112 printKey(20,280,"<--","");
bhavk11 4:5b088ba4f1f1 113 }
bhavk11 4:5b088ba4f1f1 114
bhavk11 4:5b088ba4f1f1 115 int getKey()
bhavk11 4:5b088ba4f1f1 116 {
bhavk11 4:5b088ba4f1f1 117 int key = -1;
bhavk11 4:5b088ba4f1f1 118 point p;
bhavk11 4:5b088ba4f1f1 119 int count = 0;
bhavk11 4:5b088ba4f1f1 120 if(TFT.getTouch(p) == TFT.NO || TFT.getTouch(p) == TFT.MAYBE)
bhavk11 4:5b088ba4f1f1 121 { return key;
bhavk11 4:5b088ba4f1f1 122 }
bhavk11 4:5b088ba4f1f1 123 while(TFT.getTouch(p) == TFT.YES)
bhavk11 4:5b088ba4f1f1 124 {
bhavk11 4:5b088ba4f1f1 125 count++;
bhavk11 4:5b088ba4f1f1 126 }
bhavk11 4:5b088ba4f1f1 127 if(count > 300)
bhavk11 4:5b088ba4f1f1 128 {
bhavk11 4:5b088ba4f1f1 129 //TFT.foreground(Black);
bhavk11 4:5b088ba4f1f1 130 // TFT.set_font((unsigned char*) Arial12x12);
bhavk11 4:5b088ba4f1f1 131 // TFT.locate(0,0);
bhavk11 4:5b088ba4f1f1 132 // TFT.printf("X:%d, Y:%d\n\r",p.x,p.y);
bhavk11 4:5b088ba4f1f1 133 if (p.x>2700 && p.x<7250)
bhavk11 4:5b088ba4f1f1 134 {
bhavk11 4:5b088ba4f1f1 135 if(p.x<3750)
bhavk11 4:5b088ba4f1f1 136 {
bhavk11 4:5b088ba4f1f1 137 if(p.y<3000)
bhavk11 4:5b088ba4f1f1 138 key = 1; //1
bhavk11 4:5b088ba4f1f1 139 else if(p.y<5250)
bhavk11 4:5b088ba4f1f1 140 key = 2; //2
bhavk11 4:5b088ba4f1f1 141 else
bhavk11 4:5b088ba4f1f1 142 key = 3; //3
bhavk11 4:5b088ba4f1f1 143 }
bhavk11 4:5b088ba4f1f1 144 else if(p.x<4600)
bhavk11 4:5b088ba4f1f1 145 {
bhavk11 4:5b088ba4f1f1 146 if(p.y<3000)
bhavk11 4:5b088ba4f1f1 147 key = 4; //4
bhavk11 4:5b088ba4f1f1 148 else if(p.y<5250)
bhavk11 4:5b088ba4f1f1 149 key = 5; //5
bhavk11 4:5b088ba4f1f1 150 else
bhavk11 4:5b088ba4f1f1 151 key = 6; //6
bhavk11 4:5b088ba4f1f1 152 }
bhavk11 4:5b088ba4f1f1 153 else if(p.x<5400)
bhavk11 4:5b088ba4f1f1 154 {
bhavk11 4:5b088ba4f1f1 155 if(p.y<3000)
bhavk11 4:5b088ba4f1f1 156 key = 7; //7
bhavk11 4:5b088ba4f1f1 157 else if(p.y<5250)
bhavk11 4:5b088ba4f1f1 158 key = 8; //8
bhavk11 4:5b088ba4f1f1 159 else
bhavk11 4:5b088ba4f1f1 160 key = 9; //9
bhavk11 4:5b088ba4f1f1 161 }
bhavk11 4:5b088ba4f1f1 162 else if(p.x<6300)
bhavk11 4:5b088ba4f1f1 163 {
bhavk11 4:5b088ba4f1f1 164 if(p.y<3000)
bhavk11 4:5b088ba4f1f1 165 key = 42; //*
bhavk11 4:5b088ba4f1f1 166 else if(p.y<5250)
bhavk11 4:5b088ba4f1f1 167 key = 0; //0
bhavk11 4:5b088ba4f1f1 168 else
bhavk11 4:5b088ba4f1f1 169 key = 35; //#
bhavk11 4:5b088ba4f1f1 170 }
bhavk11 4:5b088ba4f1f1 171 else
bhavk11 4:5b088ba4f1f1 172 {
bhavk11 4:5b088ba4f1f1 173 if(p.y<3000)
bhavk11 4:5b088ba4f1f1 174 key = 60; // back
bhavk11 4:5b088ba4f1f1 175 else
bhavk11 4:5b088ba4f1f1 176 key = 43; // go (call/text)
bhavk11 4:5b088ba4f1f1 177 }
bhavk11 4:5b088ba4f1f1 178 }
bhavk11 4:5b088ba4f1f1 179 if(p.x > 2200 && p.x < 2500 && p.y > 6200 && p.y < 7000)
bhavk11 4:5b088ba4f1f1 180 key = 127;
bhavk11 4:5b088ba4f1f1 181 }
bhavk11 4:5b088ba4f1f1 182 return key;
bhavk11 4:5b088ba4f1f1 183 }
bhavk11 4:5b088ba4f1f1 184
uswickra 5:c1af1f8fa026 185 char ip0[] = {' ','0','+'};
uswickra 5:c1af1f8fa026 186 char ip2[] = {'a','b','c','2'};
uswickra 5:c1af1f8fa026 187 char ip3[] = {'d','e','f','3'};
uswickra 5:c1af1f8fa026 188 char ip4[] = {'g','h','i','4'};
uswickra 5:c1af1f8fa026 189 char ip5[] = {'j','k','l','5'};
uswickra 5:c1af1f8fa026 190 char ip6[] = {'m','o','p','6'};
uswickra 5:c1af1f8fa026 191 char ip7[] = {'p','q','r','s','7'};
uswickra 5:c1af1f8fa026 192 char ip8[] = {'t','u','v','8'};
uswickra 5:c1af1f8fa026 193 char ip9[] = {'w','x','y','z','9'};
bhavk11 4:5b088ba4f1f1 194
bhavk11 4:5b088ba4f1f1 195
bhavk11 4:5b088ba4f1f1 196 bool displayChar(point& cursor, char letter)
bhavk11 4:5b088ba4f1f1 197 {
bhavk11 4:5b088ba4f1f1 198 TFT.locate(cursor.x,cursor.y);
uswickra 5:c1af1f8fa026 199 if(cursor.x + 12 <= 228)
uswickra 5:c1af1f8fa026 200 cursor.x += 12;
bhavk11 4:5b088ba4f1f1 201 else
bhavk11 4:5b088ba4f1f1 202 {
bhavk11 4:5b088ba4f1f1 203 cursor.x = 0;
bhavk11 4:5b088ba4f1f1 204 if(cursor.y + 21 <= 65 )
bhavk11 4:5b088ba4f1f1 205 cursor.y += 21;
bhavk11 4:5b088ba4f1f1 206 else
bhavk11 4:5b088ba4f1f1 207 return false;
bhavk11 4:5b088ba4f1f1 208 }
uswickra 5:c1af1f8fa026 209 TFT.set_font((unsigned char*) Arial12x12);
bhavk11 4:5b088ba4f1f1 210 TFT.printf("%c",letter);
bhavk11 4:5b088ba4f1f1 211 return true;
bhavk11 4:5b088ba4f1f1 212 }
bhavk11 4:5b088ba4f1f1 213
uswickra 5:c1af1f8fa026 214 int getAlpha(point& x, char** pt)
uswickra 5:c1af1f8fa026 215 {
uswickra 5:c1af1f8fa026 216 int touchCount = 1, count = 1;
uswickra 5:c1af1f8fa026 217 int key, begin, end;
uswickra 5:c1af1f8fa026 218 int prevKey;
uswickra 5:c1af1f8fa026 219 do {
uswickra 5:c1af1f8fa026 220 prevKey = key = getKey();
bhavk11 6:2a920ec91d2b 221 }while(prevKey == -1 && strcmp(cmd, "Text") == 0);
uswickra 5:c1af1f8fa026 222
uswickra 5:c1af1f8fa026 223 point cursor = x;
uswickra 5:c1af1f8fa026 224 char* ptr = *pt;
uswickra 5:c1af1f8fa026 225 t.reset();
uswickra 5:c1af1f8fa026 226 t.start();
uswickra 5:c1af1f8fa026 227 begin = t.read_ms();
uswickra 5:c1af1f8fa026 228 end = t.read_ms();
uswickra 5:c1af1f8fa026 229 while((end - begin) < 2000)
uswickra 5:c1af1f8fa026 230 {
uswickra 5:c1af1f8fa026 231 cursor = x;
uswickra 5:c1af1f8fa026 232 ptr = *pt;
uswickra 5:c1af1f8fa026 233 touchCount = count;
uswickra 5:c1af1f8fa026 234 START:
uswickra 5:c1af1f8fa026 235 switch(key)
uswickra 5:c1af1f8fa026 236 {
uswickra 5:c1af1f8fa026 237 case 0:
uswickra 5:c1af1f8fa026 238 touchCount = (touchCount-1)%(sizeof(ip0)/sizeof(ip0[0]));
uswickra 5:c1af1f8fa026 239 if(displayChar(cursor, ip0[touchCount])) {
uswickra 5:c1af1f8fa026 240 *ptr = ip0[touchCount];
uswickra 5:c1af1f8fa026 241 ptr++;
uswickra 5:c1af1f8fa026 242 }
uswickra 5:c1af1f8fa026 243 break;
uswickra 5:c1af1f8fa026 244 case 1:
uswickra 5:c1af1f8fa026 245 if(displayChar(cursor, '1')) {
uswickra 5:c1af1f8fa026 246 *ptr = '1';
uswickra 5:c1af1f8fa026 247 ptr++;
uswickra 5:c1af1f8fa026 248 }
uswickra 5:c1af1f8fa026 249 break;
uswickra 5:c1af1f8fa026 250 case 2:
uswickra 5:c1af1f8fa026 251 touchCount = (touchCount-1)%(sizeof(ip2)/sizeof(ip2[0]));
uswickra 5:c1af1f8fa026 252 if(displayChar(cursor, ip2[touchCount])) {
uswickra 5:c1af1f8fa026 253 *ptr = ip2[touchCount];
uswickra 5:c1af1f8fa026 254 ptr++;
uswickra 5:c1af1f8fa026 255 }
uswickra 5:c1af1f8fa026 256 break;
uswickra 5:c1af1f8fa026 257 case 3:
uswickra 5:c1af1f8fa026 258 touchCount = (touchCount-1)%(sizeof(ip3)/sizeof(ip3[0]));
uswickra 5:c1af1f8fa026 259 if(displayChar(cursor, ip3[touchCount])) {
uswickra 5:c1af1f8fa026 260 *ptr = ip3[touchCount];
uswickra 5:c1af1f8fa026 261 ptr++;
uswickra 5:c1af1f8fa026 262 }
uswickra 5:c1af1f8fa026 263 break;
uswickra 5:c1af1f8fa026 264 case 4:
uswickra 5:c1af1f8fa026 265 touchCount = (touchCount-1)%(sizeof(ip4)/sizeof(ip4[0]));
uswickra 5:c1af1f8fa026 266 if(displayChar(cursor, ip4[touchCount])) {
uswickra 5:c1af1f8fa026 267 *ptr = ip4[touchCount];
uswickra 5:c1af1f8fa026 268 ptr++;
uswickra 5:c1af1f8fa026 269 }
uswickra 5:c1af1f8fa026 270 break;
uswickra 5:c1af1f8fa026 271 case 5:
uswickra 5:c1af1f8fa026 272 touchCount = (touchCount-1)%(sizeof(ip5)/sizeof(ip5[0]));
uswickra 5:c1af1f8fa026 273 if(displayChar(cursor, ip5[touchCount])) {
uswickra 5:c1af1f8fa026 274 *ptr = ip5[touchCount];
uswickra 5:c1af1f8fa026 275 ptr++;
uswickra 5:c1af1f8fa026 276 }
uswickra 5:c1af1f8fa026 277 break;
uswickra 5:c1af1f8fa026 278 case 6:
uswickra 5:c1af1f8fa026 279 touchCount = (touchCount-1)%(sizeof(ip6)/sizeof(ip6[0]));
uswickra 5:c1af1f8fa026 280 if(displayChar(cursor, ip6[touchCount])) {
uswickra 5:c1af1f8fa026 281 *ptr = ip6[touchCount];
uswickra 5:c1af1f8fa026 282 ptr++;
uswickra 5:c1af1f8fa026 283 }
uswickra 5:c1af1f8fa026 284 break;
uswickra 5:c1af1f8fa026 285 case 7:
uswickra 5:c1af1f8fa026 286 touchCount = (touchCount-1)%(sizeof(ip7)/sizeof(ip7[0]));
uswickra 5:c1af1f8fa026 287 if(displayChar(cursor, ip7[touchCount])) {
uswickra 5:c1af1f8fa026 288 *ptr = ip7[touchCount];
uswickra 5:c1af1f8fa026 289 ptr++;
uswickra 5:c1af1f8fa026 290 }
uswickra 5:c1af1f8fa026 291 break;
uswickra 5:c1af1f8fa026 292 case 8:
uswickra 5:c1af1f8fa026 293 touchCount = (touchCount-1)%(sizeof(ip8)/sizeof(ip8[0]));
uswickra 5:c1af1f8fa026 294 if(displayChar(cursor, ip8[touchCount])) {
uswickra 5:c1af1f8fa026 295 *ptr = ip8[touchCount];
uswickra 5:c1af1f8fa026 296 ptr++;
uswickra 5:c1af1f8fa026 297 }
uswickra 5:c1af1f8fa026 298 break;
uswickra 5:c1af1f8fa026 299 case 9:
uswickra 5:c1af1f8fa026 300 touchCount = (touchCount-1)%(sizeof(ip9)/sizeof(ip9[0]));
uswickra 5:c1af1f8fa026 301 if(displayChar(cursor, ip9[touchCount])) {
uswickra 5:c1af1f8fa026 302 *ptr = ip9[touchCount];
uswickra 5:c1af1f8fa026 303 ptr++;
uswickra 5:c1af1f8fa026 304 }
uswickra 5:c1af1f8fa026 305 break;
uswickra 5:c1af1f8fa026 306 case 35:
uswickra 5:c1af1f8fa026 307 if(displayChar(cursor, '#')) {
uswickra 5:c1af1f8fa026 308 *ptr = '#';
uswickra 5:c1af1f8fa026 309 ptr++;
uswickra 5:c1af1f8fa026 310 }
uswickra 5:c1af1f8fa026 311 break;
uswickra 5:c1af1f8fa026 312 case 42:
uswickra 5:c1af1f8fa026 313 if(displayChar(cursor, '*')) {
uswickra 5:c1af1f8fa026 314 *ptr = '*';
uswickra 5:c1af1f8fa026 315 ptr++;
uswickra 5:c1af1f8fa026 316 }
uswickra 5:c1af1f8fa026 317 break;
uswickra 5:c1af1f8fa026 318 }
uswickra 5:c1af1f8fa026 319
uswickra 5:c1af1f8fa026 320 key = getKey();
uswickra 5:c1af1f8fa026 321 end = t.read_ms();
uswickra 5:c1af1f8fa026 322 if(key == -1 && ((end - begin) < 2000)) goto START;
uswickra 5:c1af1f8fa026 323
uswickra 5:c1af1f8fa026 324 if(!(prevKey == key)){
uswickra 5:c1af1f8fa026 325 break;
uswickra 5:c1af1f8fa026 326 }
uswickra 5:c1af1f8fa026 327 count++;
uswickra 5:c1af1f8fa026 328
uswickra 5:c1af1f8fa026 329 pc.printf("ok curr count :%d key : %d prev_key : %d \r\n", touchCount,key, prevKey);
uswickra 5:c1af1f8fa026 330 }
uswickra 5:c1af1f8fa026 331 t.stop();
uswickra 5:c1af1f8fa026 332 pc.printf("ok count is :%d \r\n", touchCount);
uswickra 5:c1af1f8fa026 333
uswickra 5:c1af1f8fa026 334 x = cursor;
uswickra 5:c1af1f8fa026 335 *pt = ptr;
uswickra 5:c1af1f8fa026 336 return prevKey;
uswickra 5:c1af1f8fa026 337 }
uswickra 5:c1af1f8fa026 338
uswickra 5:c1af1f8fa026 339
uswickra 5:c1af1f8fa026 340 void init_modem(){
uswickra 5:c1af1f8fa026 341 modem_power = 1 ;
uswickra 5:c1af1f8fa026 342 wait(1);
uswickra 5:c1af1f8fa026 343 // gsm.serial_modem.attach(&messageHandle);
uswickra 5:c1af1f8fa026 344 while(gsm.init() != 1) {
uswickra 5:c1af1f8fa026 345 // TFT.printf("waiting... \r\n");
uswickra 5:c1af1f8fa026 346 wait(1);
uswickra 5:c1af1f8fa026 347 }
uswickra 7:5cf5aeae1954 348 gsm.serial_modem.attach(&rxCallback, Serial::RxIrq);
uswickra 5:c1af1f8fa026 349 }
uswickra 5:c1af1f8fa026 350
uswickra 5:c1af1f8fa026 351
neilt6 0:407dafce805d 352 int main()
neilt6 0:407dafce805d 353 {
bhavk11 4:5b088ba4f1f1 354 point p;
bhavk11 6:2a920ec91d2b 355 bool isMsg = false;
bhavk11 6:2a920ec91d2b 356 char numbuffer[140];
bhavk11 6:2a920ec91d2b 357 char msgbuffer[140];
bhavk11 6:2a920ec91d2b 358
neilt6 0:407dafce805d 359 //Configure the display driver
neilt6 0:407dafce805d 360 TFT.background(Black);
neilt6 0:407dafce805d 361 TFT.foreground(White);
neilt6 0:407dafce805d 362 TFT.cls();
uswickra 5:c1af1f8fa026 363 //initialize the modem - may take few seconds
uswickra 5:c1af1f8fa026 364 init_modem();
uswickra 5:c1af1f8fa026 365
bhavk11 4:5b088ba4f1f1 366 while(true)
bhavk11 4:5b088ba4f1f1 367 {
bhavk11 4:5b088ba4f1f1 368 //Print a welcome message
bhavk11 4:5b088ba4f1f1 369 TFT.background(White);
bhavk11 4:5b088ba4f1f1 370 TFT.set_font((unsigned char*) Neu42x35);
bhavk11 4:5b088ba4f1f1 371 TFT.foreground(Maroon);
bhavk11 4:5b088ba4f1f1 372 TFT.cls();
uswickra 5:c1af1f8fa026 373
bhavk11 4:5b088ba4f1f1 374 TFT.locate(100,60);
bhavk11 4:5b088ba4f1f1 375 TFT.printf("IU");
bhavk11 4:5b088ba4f1f1 376
bhavk11 4:5b088ba4f1f1 377 TFT.set_font((unsigned char*) Arial24x23);
bhavk11 4:5b088ba4f1f1 378 TFT.locate(28,230);
bhavk11 4:5b088ba4f1f1 379 TFT.printf("CALL");
bhavk11 4:5b088ba4f1f1 380 TFT.circle(60,240,50,Maroon);
bhavk11 4:5b088ba4f1f1 381
bhavk11 4:5b088ba4f1f1 382 TFT.locate(140,230);
bhavk11 4:5b088ba4f1f1 383 TFT.printf("TEXT");
bhavk11 4:5b088ba4f1f1 384 TFT.circle(180,240,50,Maroon);
bhavk11 4:5b088ba4f1f1 385
bhavk11 9:f226caed4c66 386 while((strcmp(cmd, "Back") == 0) || cmd == NULL)
bhavk11 4:5b088ba4f1f1 387 {
bhavk11 4:5b088ba4f1f1 388 if (TFT.getTouch(p) == TFT.YES)
bhavk11 4:5b088ba4f1f1 389 {
bhavk11 4:5b088ba4f1f1 390 if(p.x >= 4500 && p.x <= 6600)
bhavk11 4:5b088ba4f1f1 391 {
bhavk11 4:5b088ba4f1f1 392 if(p.y >= 1500 && p.y <= 3800)
bhavk11 4:5b088ba4f1f1 393 {
bhavk11 4:5b088ba4f1f1 394 //call
bhavk11 4:5b088ba4f1f1 395 cmd = "Call";
bhavk11 4:5b088ba4f1f1 396 }
bhavk11 4:5b088ba4f1f1 397 else if(p.y >= 4500 && p.y <= 7100)
bhavk11 4:5b088ba4f1f1 398 {
bhavk11 4:5b088ba4f1f1 399 //text
bhavk11 4:5b088ba4f1f1 400 cmd = "Text";
bhavk11 4:5b088ba4f1f1 401 }
bhavk11 4:5b088ba4f1f1 402 }
bhavk11 9:f226caed4c66 403 }
bhavk11 4:5b088ba4f1f1 404 }
bhavk11 4:5b088ba4f1f1 405
bhavk11 4:5b088ba4f1f1 406 if(strcmp(cmd, "Call") == 0)
bhavk11 4:5b088ba4f1f1 407 {
bhavk11 4:5b088ba4f1f1 408 initKeypad();
bhavk11 6:2a920ec91d2b 409 if(!isMsg)
bhavk11 6:2a920ec91d2b 410 printKey(130,280,"CALL","" );
bhavk11 6:2a920ec91d2b 411 else
bhavk11 6:2a920ec91d2b 412 printKey(130,280,"SEND","" );
bhavk11 4:5b088ba4f1f1 413 point cursor;
bhavk11 4:5b088ba4f1f1 414 cursor.x = 0;
bhavk11 4:5b088ba4f1f1 415 cursor.y = 5;
bhavk11 6:2a920ec91d2b 416 char *ptr = numbuffer;
bhavk11 4:5b088ba4f1f1 417 while(strcmp(cmd, "Call") == 0)
bhavk11 4:5b088ba4f1f1 418 {
bhavk11 4:5b088ba4f1f1 419 TFT.foreground(Black);
bhavk11 4:5b088ba4f1f1 420 int key = getKey();
bhavk11 4:5b088ba4f1f1 421 switch(key)
bhavk11 4:5b088ba4f1f1 422 {
bhavk11 4:5b088ba4f1f1 423 case 0:
bhavk11 4:5b088ba4f1f1 424 if(displayChar(cursor, '0')) {
bhavk11 4:5b088ba4f1f1 425 *ptr = '0';
bhavk11 4:5b088ba4f1f1 426 ptr++;
bhavk11 4:5b088ba4f1f1 427 }
bhavk11 4:5b088ba4f1f1 428 break;
bhavk11 4:5b088ba4f1f1 429 case 1:
bhavk11 4:5b088ba4f1f1 430 if(displayChar(cursor, '1')) {
bhavk11 4:5b088ba4f1f1 431 *ptr = '1';
bhavk11 4:5b088ba4f1f1 432 ptr++;
bhavk11 4:5b088ba4f1f1 433 }
bhavk11 4:5b088ba4f1f1 434 break;
bhavk11 4:5b088ba4f1f1 435 case 2:
bhavk11 4:5b088ba4f1f1 436 if(displayChar(cursor, '2')) {
bhavk11 4:5b088ba4f1f1 437 *ptr = '2';
bhavk11 4:5b088ba4f1f1 438 ptr++;
bhavk11 4:5b088ba4f1f1 439 }
bhavk11 4:5b088ba4f1f1 440 break;
bhavk11 4:5b088ba4f1f1 441 case 3:
bhavk11 4:5b088ba4f1f1 442 if(displayChar(cursor, '3')) {
bhavk11 4:5b088ba4f1f1 443 *ptr = '3';
bhavk11 4:5b088ba4f1f1 444 ptr++;
bhavk11 4:5b088ba4f1f1 445 }
bhavk11 4:5b088ba4f1f1 446 break;
bhavk11 4:5b088ba4f1f1 447 case 4:
bhavk11 4:5b088ba4f1f1 448 if(displayChar(cursor, '4')) {
bhavk11 4:5b088ba4f1f1 449 *ptr = '4';
bhavk11 4:5b088ba4f1f1 450 ptr++;
bhavk11 4:5b088ba4f1f1 451 }
bhavk11 4:5b088ba4f1f1 452 break;
bhavk11 4:5b088ba4f1f1 453 case 5:
bhavk11 4:5b088ba4f1f1 454 if(displayChar(cursor, '5')) {
bhavk11 4:5b088ba4f1f1 455 *ptr = '5';
bhavk11 4:5b088ba4f1f1 456 ptr++;
bhavk11 4:5b088ba4f1f1 457 }
bhavk11 4:5b088ba4f1f1 458 break;
bhavk11 4:5b088ba4f1f1 459 case 6:
bhavk11 4:5b088ba4f1f1 460 if(displayChar(cursor, '6')) {
bhavk11 4:5b088ba4f1f1 461 *ptr = '6';
bhavk11 4:5b088ba4f1f1 462 ptr++;
bhavk11 4:5b088ba4f1f1 463 }
bhavk11 4:5b088ba4f1f1 464 break;
bhavk11 4:5b088ba4f1f1 465 case 7:
bhavk11 4:5b088ba4f1f1 466 if(displayChar(cursor, '7')) {
bhavk11 4:5b088ba4f1f1 467 *ptr = '7';
bhavk11 4:5b088ba4f1f1 468 ptr++;
bhavk11 4:5b088ba4f1f1 469 }
bhavk11 4:5b088ba4f1f1 470 break;
bhavk11 4:5b088ba4f1f1 471 case 8:
bhavk11 4:5b088ba4f1f1 472 if(displayChar(cursor, '8')) {
bhavk11 4:5b088ba4f1f1 473 *ptr = '8';
bhavk11 4:5b088ba4f1f1 474 ptr++;
bhavk11 4:5b088ba4f1f1 475 }
bhavk11 4:5b088ba4f1f1 476 break;
bhavk11 4:5b088ba4f1f1 477 case 9:
bhavk11 4:5b088ba4f1f1 478 if(displayChar(cursor, '9')) {
bhavk11 4:5b088ba4f1f1 479 *ptr = '9';
bhavk11 4:5b088ba4f1f1 480 ptr++;
bhavk11 4:5b088ba4f1f1 481 }
bhavk11 4:5b088ba4f1f1 482 break;
bhavk11 4:5b088ba4f1f1 483 case 35:
bhavk11 4:5b088ba4f1f1 484 if(displayChar(cursor, '#')) {
bhavk11 4:5b088ba4f1f1 485 *ptr = '#';
bhavk11 4:5b088ba4f1f1 486 ptr++;
bhavk11 4:5b088ba4f1f1 487 }
bhavk11 4:5b088ba4f1f1 488 break;
bhavk11 4:5b088ba4f1f1 489 case 42:
bhavk11 4:5b088ba4f1f1 490 if(displayChar(cursor, '*')) {
bhavk11 4:5b088ba4f1f1 491 *ptr = '*';
bhavk11 4:5b088ba4f1f1 492 ptr++;
bhavk11 4:5b088ba4f1f1 493 }
bhavk11 4:5b088ba4f1f1 494 break;
bhavk11 4:5b088ba4f1f1 495 case 43:
bhavk11 6:2a920ec91d2b 496 if(isMsg)
bhavk11 6:2a920ec91d2b 497 cmd = "Send";
bhavk11 6:2a920ec91d2b 498 else
bhavk11 6:2a920ec91d2b 499 cmd = "Make";
bhavk11 6:2a920ec91d2b 500 isMsg = false;
uswickra 5:c1af1f8fa026 501 *ptr= '\0';
bhavk11 4:5b088ba4f1f1 502 break;
bhavk11 4:5b088ba4f1f1 503 case 60:
bhavk11 4:5b088ba4f1f1 504 cmd = "Back";
bhavk11 6:2a920ec91d2b 505 isMsg = false;
bhavk11 4:5b088ba4f1f1 506 break;
bhavk11 4:5b088ba4f1f1 507 case 127:
bhavk11 6:2a920ec91d2b 508 if(ptr > numbuffer)
bhavk11 4:5b088ba4f1f1 509 {
bhavk11 4:5b088ba4f1f1 510 ptr--;
uswickra 5:c1af1f8fa026 511 if(cursor.x - 12 >= 0)
uswickra 5:c1af1f8fa026 512 cursor.x -= 12;
bhavk11 4:5b088ba4f1f1 513 else
bhavk11 4:5b088ba4f1f1 514 {
uswickra 5:c1af1f8fa026 515 cursor.x = 240;
bhavk11 4:5b088ba4f1f1 516 if(cursor.y - 21 >= 5 )
bhavk11 4:5b088ba4f1f1 517 cursor.y -= 21;
bhavk11 4:5b088ba4f1f1 518 }
bhavk11 4:5b088ba4f1f1 519 TFT.locate(cursor.x,cursor.y);
bhavk11 4:5b088ba4f1f1 520 TFT.printf(" ");
bhavk11 4:5b088ba4f1f1 521 }
bhavk11 4:5b088ba4f1f1 522 break;
bhavk11 4:5b088ba4f1f1 523 }
bhavk11 4:5b088ba4f1f1 524 }
bhavk11 4:5b088ba4f1f1 525 if(strcmp(cmd, "Make") == 0)
bhavk11 4:5b088ba4f1f1 526 {
bhavk11 4:5b088ba4f1f1 527 TFT.background(Black);
bhavk11 4:5b088ba4f1f1 528 TFT.foreground(White);
bhavk11 4:5b088ba4f1f1 529 TFT.cls();
bhavk11 4:5b088ba4f1f1 530 int i=0;
bhavk11 4:5b088ba4f1f1 531 cursor.x = 0;
bhavk11 4:5b088ba4f1f1 532 cursor.y = 5;
bhavk11 4:5b088ba4f1f1 533 TFT.locate(0,0);
uswickra 7:5cf5aeae1954 534 int ret = gsm.call_phone(numbuffer);
bhavk11 6:2a920ec91d2b 535 while(&numbuffer[i] < ptr)
bhavk11 6:2a920ec91d2b 536 displayChar(cursor, numbuffer[i++]);
bhavk11 4:5b088ba4f1f1 537 TFT.line(0,270,240,270,Red);
bhavk11 4:5b088ba4f1f1 538 TFT.foreground(Red);
bhavk11 4:5b088ba4f1f1 539 TFT.locate(60,280);
bhavk11 4:5b088ba4f1f1 540 TFT.printf("Hang Up");
uswickra 10:5ea126441b8a 541 int_state = 0 ;
bhavk11 4:5b088ba4f1f1 542 while(strcmp(cmd, "Make") == 0)
bhavk11 4:5b088ba4f1f1 543 {
uswickra 5:c1af1f8fa026 544 if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250){
uswickra 5:c1af1f8fa026 545 gsm.hangup_phone();
uswickra 10:5ea126441b8a 546 int_state = 1 ;
bhavk11 4:5b088ba4f1f1 547 cmd = "Back";
uswickra 5:c1af1f8fa026 548
uswickra 5:c1af1f8fa026 549 }
bhavk11 4:5b088ba4f1f1 550 }
bhavk11 4:5b088ba4f1f1 551 }
bhavk11 6:2a920ec91d2b 552 else if(strcmp(cmd,"Send") == 0)
bhavk11 6:2a920ec91d2b 553 {
bhavk11 6:2a920ec91d2b 554 // numbuffer has number
bhavk11 6:2a920ec91d2b 555 // msgbuffer has msg
bhavk11 6:2a920ec91d2b 556 TFT.background(Black);
bhavk11 6:2a920ec91d2b 557 TFT.foreground(White);
bhavk11 6:2a920ec91d2b 558 TFT.cls();
bhavk11 6:2a920ec91d2b 559 TFT.locate(90,60);
bhavk11 6:2a920ec91d2b 560 TFT.printf("Text %s",msgbuffer);
bhavk11 6:2a920ec91d2b 561 TFT.locate(90,95);
bhavk11 6:2a920ec91d2b 562 TFT.printf("Sent to %s!",numbuffer);
bhavk11 6:2a920ec91d2b 563 wait(2.5);
bhavk11 6:2a920ec91d2b 564 cmd = "Back";
bhavk11 6:2a920ec91d2b 565 }
bhavk11 4:5b088ba4f1f1 566 if(strcmp(cmd, "Back") == 0)
bhavk11 4:5b088ba4f1f1 567 {
bhavk11 4:5b088ba4f1f1 568 //Home screen
bhavk11 4:5b088ba4f1f1 569 }
bhavk11 4:5b088ba4f1f1 570 }
bhavk11 4:5b088ba4f1f1 571 else if(strcmp(cmd, "Text") == 0)
bhavk11 4:5b088ba4f1f1 572 {
bhavk11 4:5b088ba4f1f1 573 initKeypad();
bhavk11 4:5b088ba4f1f1 574 printKey(130,280,"SEND","" );
bhavk11 4:5b088ba4f1f1 575 point cursor;
bhavk11 4:5b088ba4f1f1 576 cursor.x = 0;
bhavk11 4:5b088ba4f1f1 577 cursor.y = 5;
bhavk11 6:2a920ec91d2b 578 char *ptr = msgbuffer;
bhavk11 4:5b088ba4f1f1 579 //TFT.line(80,100,80,320,Black);
bhavk11 4:5b088ba4f1f1 580 // TFT.line(160,100,160,320,Black);
bhavk11 4:5b088ba4f1f1 581 // TFT.line(0,100,240,100,Black);
bhavk11 4:5b088ba4f1f1 582 // TFT.line(0,150,240,150,Black);
bhavk11 4:5b088ba4f1f1 583 // TFT.line(0,190,240,190,Black);
bhavk11 4:5b088ba4f1f1 584 // TFT.line(0,230,240,230,Black);
bhavk11 4:5b088ba4f1f1 585 // TFT.line(0,270,240,270,Black);
bhavk11 4:5b088ba4f1f1 586 while(strcmp(cmd, "Text") == 0)
bhavk11 4:5b088ba4f1f1 587 {
uswickra 5:c1af1f8fa026 588 int key = getAlpha(cursor, &ptr);
uswickra 5:c1af1f8fa026 589
bhavk11 4:5b088ba4f1f1 590 switch(key)
bhavk11 4:5b088ba4f1f1 591 {
bhavk11 4:5b088ba4f1f1 592 case 43:
bhavk11 6:2a920ec91d2b 593 isMsg = true;
bhavk11 6:2a920ec91d2b 594 cmd = "Call";
bhavk11 4:5b088ba4f1f1 595 break;
bhavk11 4:5b088ba4f1f1 596 case 60:
bhavk11 4:5b088ba4f1f1 597 cmd = "Back";
bhavk11 4:5b088ba4f1f1 598 break;
bhavk11 4:5b088ba4f1f1 599 case 127:
bhavk11 6:2a920ec91d2b 600 if(ptr > msgbuffer)
bhavk11 4:5b088ba4f1f1 601 {
bhavk11 4:5b088ba4f1f1 602 ptr--;
uswickra 5:c1af1f8fa026 603 if(cursor.x - 12 >= 0)
uswickra 5:c1af1f8fa026 604 cursor.x -= 12;
bhavk11 4:5b088ba4f1f1 605 else
bhavk11 4:5b088ba4f1f1 606 {
uswickra 5:c1af1f8fa026 607 cursor.x = 240;
bhavk11 4:5b088ba4f1f1 608 if(cursor.y - 21 >= 5 )
bhavk11 4:5b088ba4f1f1 609 cursor.y -= 21;
bhavk11 4:5b088ba4f1f1 610 }
bhavk11 4:5b088ba4f1f1 611 TFT.locate(cursor.x,cursor.y);
bhavk11 4:5b088ba4f1f1 612 TFT.printf(" ");
bhavk11 4:5b088ba4f1f1 613 }
bhavk11 4:5b088ba4f1f1 614 break;
bhavk11 4:5b088ba4f1f1 615 }
bhavk11 4:5b088ba4f1f1 616 }
bhavk11 6:2a920ec91d2b 617 }
bhavk11 6:2a920ec91d2b 618 else if (strcmp(cmd, "Ring") == 0)
uswickra 5:c1af1f8fa026 619 {
uswickra 5:c1af1f8fa026 620 TFT.background(Black);
uswickra 5:c1af1f8fa026 621 TFT.foreground(White);
uswickra 5:c1af1f8fa026 622 TFT.cls();
uswickra 5:c1af1f8fa026 623 TFT.locate(0,0);
uswickra 5:c1af1f8fa026 624 TFT.printf("Incoming Call...");
uswickra 5:c1af1f8fa026 625 TFT.foreground(Green);
uswickra 5:c1af1f8fa026 626 TFT.set_font((unsigned char*) Arial24x23);
uswickra 5:c1af1f8fa026 627 TFT.locate(28,230);
uswickra 5:c1af1f8fa026 628 TFT.printf("ANS");
bhavk11 6:2a920ec91d2b 629 TFT.circle(60,240,50,Green);
uswickra 5:c1af1f8fa026 630
uswickra 5:c1af1f8fa026 631 TFT.foreground(Red);
bhavk11 6:2a920ec91d2b 632 TFT.locate(140,220);
bhavk11 6:2a920ec91d2b 633 TFT.printf("HANG");
bhavk11 6:2a920ec91d2b 634 TFT.locate(160,240);
bhavk11 6:2a920ec91d2b 635 TFT.printf("UP");
bhavk11 6:2a920ec91d2b 636 TFT.circle(180,240,50,Red);
bhavk11 6:2a920ec91d2b 637 while(strcmp(cmd, "Ring") == 0)
uswickra 5:c1af1f8fa026 638 {
bhavk11 6:2a920ec91d2b 639 if (TFT.getTouch(p) == TFT.YES)
bhavk11 6:2a920ec91d2b 640 {
bhavk11 6:2a920ec91d2b 641 if(p.x >= 4500 && p.x <= 6600)
bhavk11 6:2a920ec91d2b 642 {
bhavk11 6:2a920ec91d2b 643 if(p.y >= 1500 && p.y <= 3800)
bhavk11 6:2a920ec91d2b 644 {
bhavk11 6:2a920ec91d2b 645 //answer cal
bhavk11 6:2a920ec91d2b 646 cmd = "Answer";
uswickra 10:5ea126441b8a 647 gsm.recv_phone();
bhavk11 6:2a920ec91d2b 648 break;
bhavk11 6:2a920ec91d2b 649 }
bhavk11 6:2a920ec91d2b 650 else if(p.y >= 4500 && p.y <= 7100)
bhavk11 6:2a920ec91d2b 651 {
bhavk11 6:2a920ec91d2b 652 //hang up
bhavk11 6:2a920ec91d2b 653 cmd = "Back";
uswickra 10:5ea126441b8a 654 gsm.hangup_phone();
uswickra 10:5ea126441b8a 655 int_state = 1 ;
bhavk11 6:2a920ec91d2b 656 break;
bhavk11 6:2a920ec91d2b 657 }
bhavk11 6:2a920ec91d2b 658
bhavk11 6:2a920ec91d2b 659 }
bhavk11 6:2a920ec91d2b 660 }
bhavk11 6:2a920ec91d2b 661 }
bhavk11 6:2a920ec91d2b 662 if(strcmp(cmd, "Answer") == 0)
bhavk11 6:2a920ec91d2b 663 {
bhavk11 6:2a920ec91d2b 664 TFT.background(Black);
bhavk11 6:2a920ec91d2b 665 TFT.foreground(White);
bhavk11 6:2a920ec91d2b 666 TFT.cls();
bhavk11 6:2a920ec91d2b 667 TFT.locate(0,0);
bhavk11 6:2a920ec91d2b 668 TFT.printf("Call in Progress...");
bhavk11 6:2a920ec91d2b 669 TFT.line(0,270,240,270,Red);
bhavk11 6:2a920ec91d2b 670 TFT.foreground(Red);
bhavk11 6:2a920ec91d2b 671 TFT.locate(60,280);
bhavk11 6:2a920ec91d2b 672 TFT.set_font((unsigned char*) Arial24x23);
bhavk11 6:2a920ec91d2b 673 TFT.printf("Hang Up");
bhavk11 6:2a920ec91d2b 674 while(strcmp(cmd, "Answer") == 0)
bhavk11 6:2a920ec91d2b 675 {
uswickra 10:5ea126441b8a 676 if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250){
bhavk11 6:2a920ec91d2b 677 cmd = "Back";
uswickra 10:5ea126441b8a 678 gsm.hangup_phone();
uswickra 10:5ea126441b8a 679 int_state = 1 ;
uswickra 10:5ea126441b8a 680 }
uswickra 10:5ea126441b8a 681
bhavk11 6:2a920ec91d2b 682 }
uswickra 5:c1af1f8fa026 683 }
bhavk11 4:5b088ba4f1f1 684 }
bhavk11 6:2a920ec91d2b 685 else if(strcmp(cmd, "RecvM") == 0)
bhavk11 6:2a920ec91d2b 686 {}
neilt6 0:407dafce805d 687 }
neilt6 0:407dafce805d 688 }