Communicate to bluetooth devices or wifi per at-commands
Diff: at.cpp
- Revision:
- 2:b8d28a4f6b02
- Parent:
- 1:ce7fb335aa1b
- Child:
- 3:cdabd56aec53
--- a/at.cpp Thu Aug 16 21:09:12 2018 +0000 +++ b/at.cpp Sun Aug 19 07:51:33 2018 +0000 @@ -23,7 +23,7 @@ if(at0.sign != '\r') { //with no linefeed and carriage return, string is written in buffer at0.buffer[at0.a] = at0.sign; at0.a ++; - } else { //if user typed in cr and lf, the content of buffer is send to atcommand device + } else { //if cr and lf were received , the content of buffer is send to atcommand device if(at0.off == 0) { atserial0.printf("Read: %s\r\n", at0.buffer); // via printf formatted as string for debug use @@ -40,7 +40,7 @@ if(at1.sign != '\r') { //with no linefeed and carriage return, string is written in buffer at1.buffer[at1.a] = at1.sign; at1.a ++; - } else { //if user typed in cr and lf, the content of buffer is send to atcommand device + } else { //if cr and lf were received, the content of buffer is send to atcommand device if(at1.off == 0) { atserial1.printf("Read: %s\r\n", at1.buffer); // via printf formatted as string for debug use @@ -70,9 +70,11 @@ void atterm::device_init(unsigned long baud, _IRQ interrupt) { atterm::debug_off(1); - if(interrupt == ON) atserial0.attach(&CallBack0); + if(interrupt == ON) { + atserial0.attach(&CallBack0); + } atserial0.baud(baud); - + } void atterm::at_send1(char *format, char *buf) @@ -85,7 +87,9 @@ void atterm::device_init1(unsigned long baud, _IRQ interrupt) { atterm::debug_off(1); - if(interrupt == ON) atserial1.attach(&CallBack1); + if(interrupt == ON) { + atserial1.attach(&CallBack1); + } atserial1.baud(baud); at1.at_send1("AT\r\n", "");