program to test exporting mbed-dev
Fork of FONA_CellPhone by
Diff: Adafruit_FONA.cpp
- Revision:
- 2:aaef20ac9044
- Parent:
- 0:851248a56628
- Child:
- 9:06eca688f2a3
--- a/Adafruit_FONA.cpp Thu Mar 10 05:52:15 2016 +0000 +++ b/Adafruit_FONA.cpp Thu Mar 10 01:53:00 2016 -0500 @@ -24,10 +24,17 @@ #define HIGH 1 #define LOW 0 +/* +Notes George is taking: +sendCheckReply returns a boolean where its true when FONA responds with the string of its second input + +*/ + bool Adafruit_FONA::begin(int baudrate) { - mySerial.baud(baudrate); - mySerial.attach(this, &Adafruit_FONA::onSerialDataReceived, Serial::RxIrq); + mySerial.baud(baudrate); //set the baud rate of the fona serial connection + mySerial.attach(this, &Adafruit_FONA::onSerialDataReceived, Serial::RxIrq); //attached onSerialDataReceived as Serial receive interrupt + // INIT Reboot process _rstpin = HIGH; wait_ms(10); _rstpin = LOW; @@ -37,8 +44,10 @@ // give 3 seconds to reboot wait_ms(3000); + // flushes the serial port while (readable()) getc(); + // Make sure FONA is alive sendCheckReply("AT", "OK"); wait_ms(100); sendCheckReply("AT", "OK"); @@ -50,6 +59,7 @@ sendCheckReply("ATE0", "OK"); wait_ms(100); + // Just checks if the FONA even responds, if it doesnt, then return false if (! sendCheckReply("ATE0", "OK")) { return false; } @@ -1198,6 +1208,7 @@ return idx; } +// This function just reads the output from FONA after an AT command is sent to it uint8_t Adafruit_FONA::readline(uint16_t timeout, bool multiline) { uint16_t replyidx = 0;