aaaa

Dependencies:   SeeedStudioTFTv2 TFT_fonts mbed

Fork of Seeed_TFT_Touch_Shield by Bhavik Bhuta

Revision:
7:5cf5aeae1954
Parent:
6:2a920ec91d2b
Child:
9:f226caed4c66
--- a/main.cpp	Sat Oct 25 20:42:30 2014 +0000
+++ b/main.cpp	Sat Oct 25 21:55:05 2014 +0000
@@ -48,25 +48,25 @@
 Modem gsm (D10, D2, 19200, PHONE_NUMBER);
 DigitalOut modem_power(D9);
 char* cmd = NULL;
+int type = 0 ;
 
-void messageHandle(void)
-{        
-     __disable_irq();
-    int messageType = gsm.loopHandle();
-    if(MESSAGE_RING == messageType) {
-//        gsm.answer();
-        cmd = "Ring";
-        pc.printf("recieved call.. \r\n");
-    } else if(MESSAGE_SMS == messageType) {
-        char smsMessage[SMS_MAX_LENGTH];
-//        gsm.getSMS(smsMessage);
-        pc.printf("recieved sms.. \r\n");
-        int i = 0 ;
-        for(i = 0 ; i < SMS_MAX_LENGTH ; i++){
-            pc.putc(smsMessage[i]);
-        }
-    }
-    __enable_irq();
+void rxCallback() {
+//__disable_irq();
+    if(gsm.serial_modem.readable()){
+            char c = gsm.serial_modem.getc();
+            type = gsm.updateBuffer(c);
+//            pc.putc(c);
+            if(type == MESSAGE_RING){
+//                pc.putc('R');
+                  cmd = "Ring" ;
+                  TFT.printf(cmd);
+            }
+            if(type == MESSAGE_SMS){
+//                pc.putc('S');
+            }
+            
+    }   
+//__enable_irq(); 
 }
 
 
@@ -343,6 +343,7 @@
 //        TFT.printf("waiting... \r\n");
         wait(1);
     }  
+    gsm.serial_modem.attach(&rxCallback, Serial::RxIrq);
 }
 
 
@@ -534,7 +535,7 @@
                 cursor.x = 0;
                 cursor.y = 5;
                 TFT.locate(0,0);
-                int ret = gsm.call_phone(buffer);
+                int ret = gsm.call_phone(numbuffer);
                 while(&numbuffer[i] < ptr)
                     displayChar(cursor, numbuffer[i++]);
                 TFT.line(0,270,240,270,Red);