Communicate to bluetooth devices or wifi per at-commands

Dependents:   Nucleo_bt

Revision:
5:31306be5fde6
Parent:
4:96aa57261092
Child:
6:194ceedbb7c3
--- a/at.cpp	Sun Aug 26 10:50:45 2018 +0000
+++ b/at.cpp	Sun Aug 26 20:16:16 2018 +0000
@@ -58,7 +58,7 @@
 
 
     if(pc.sign != '\r')  {  //with no linefeed and carriage return, string is written in buffer
-        pc.buffer[at1.a] = pc.sign;
+        pc.buffer[pc.a] = pc.sign;
         pc.a ++;
     } else {   //if cr and lf were received, the content of buffer is send to atcommand device
 
@@ -120,7 +120,7 @@
     terminal.printf(format, buf);
 }
 
-void atterm::device_init2(unsigned long baud, _IRQ interrupt)
+void atterm::terminal_init(unsigned long baud, _IRQ interrupt)
 {
     atterm::debug_off(1);
     if(interrupt == ON)  {
@@ -134,7 +134,7 @@
 
 char *atterm::getAnswer(uint32_t timeout)
 {
-    int b = 0;
+    int b = 0, b1 = 0, b2 = 0;
     uint32_t t_time = 0;
     char sign, sign1, sign2;
 
@@ -152,14 +152,14 @@
 
         else if(atserial1.readable())  {
             sign1 = atserial1.getc();
-            read_timed_buffer[b] = sign1;
-            b ++;
+            read_timed_buffer[b1] = sign1;
+            b1 ++;
         }
         
         else if(terminal.readable())  {
             sign2 = terminal.getc();
-            read_timed_buffer[b] = sign2;
-            b ++;
+            read_timed_buffer[b2] = sign2;
+            b2 ++;
         }
         
         if((t.read_ms() - t_time) > timeout)  {