aaaa

Dependencies:   SeeedStudioTFTv2 TFT_fonts mbed

Fork of Seeed_TFT_Touch_Shield by Bhavik Bhuta

Revision:
10:5ea126441b8a
Parent:
9:f226caed4c66
Child:
11:575dfd388778
--- a/main.cpp	Sat Oct 25 21:57:39 2014 +0000
+++ b/main.cpp	Sat Oct 25 23:43:01 2014 +0000
@@ -49,6 +49,7 @@
 DigitalOut modem_power(D9);
 char* cmd = NULL;
 int type = 0 ;
+int int_state = 1 ;
 
 void rxCallback() {
 //__disable_irq();
@@ -56,12 +57,13 @@
             char c = gsm.serial_modem.getc();
             type = gsm.updateBuffer(c);
 //            pc.putc(c);
-            if(type == MESSAGE_RING){
+            if(int_state == 1 && type == MESSAGE_RING){
 //                pc.putc('R');
                   cmd = "Ring" ;
-                  TFT.printf(cmd);
+                  int_state = 0 ;
+//                  TFT.printf(cmd);
             }
-            if(type == MESSAGE_SMS){
+            if(int_state == 1 && type == MESSAGE_SMS){
 //                pc.putc('S');
             }
             
@@ -536,10 +538,12 @@
                 TFT.foreground(Red);
                 TFT.locate(60,280);
                 TFT.printf("Hang Up");
+                int_state = 0 ;
                 while(strcmp(cmd, "Make") == 0)
                 {
                     if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250){
                         gsm.hangup_phone();
+                        int_state = 1 ;
                         cmd = "Back";
                         
                     }
@@ -640,12 +644,15 @@
                         {
                             //answer cal
                             cmd = "Answer";
+                            gsm.recv_phone();
                             break;
                         }
                         else if(p.y >= 4500 && p.y <= 7100)
                         {
                             //hang up
                             cmd = "Back";
+                            gsm.hangup_phone();
+                            int_state = 1 ;
                             break;
                         }
                         
@@ -666,8 +673,12 @@
                 TFT.printf("Hang Up");
                 while(strcmp(cmd, "Answer") == 0)
                 {
-                    if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250)
+                    if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250){
                         cmd = "Back";
+                        gsm.hangup_phone();
+                        int_state = 1 ;
+                    }
+                        
                 }
             }
         }