Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GSM_Library by
Diff: gsmqueue.cpp
- Revision:
- 29:bc5f53f2922a
- Parent:
- 27:fe1c7eaf5b88
--- a/gsmqueue.cpp Thu Apr 23 02:06:55 2015 +0000
+++ b/gsmqueue.cpp Sat Apr 25 15:39:00 2015 +0000
@@ -8,11 +8,18 @@
#define LAST_UNPRINTABLE_CHAR 31
-extern Serial pc;
-extern Serial gsm;
+//External variables
+extern Serial pc; //Print data to serial connection with computer
+extern Serial gsm; //UART connection with GSM
-char buffer[BUFFER_LENGTH];
-char* queueHead;
+//Internal variables for a queue (wrap-around implementation)
+//Note that the DMA (direct memory access) stores data in this queue. Therefore, QUEUETAIL is incremented
+//by the DMA and we only read its value. Our queue's purpose is to read data communicated to us
+//by the GSM without having to consume processor cycles. Unfortunately when we write data to the Serial
+//port, the DMA will still write it to the buffer. For this reason, the sendCommand() function counts
+//the number of characters we send over UART so we can ignore those characters in the queue.
+char buffer[BUFFER_LENGTH]; //Stores the characters in the queue
+char* queueHead; //Queue head - marks where to read from next
char* queueHeadExp; //Expected location of queueHead after gsm.puts() finishes executing
@@ -220,10 +227,4 @@
{
queueHead = QUEUETAIL;
}
-
-//Reset the GSM DMA idle bit to 0
-void resetGSMIdleBit()
-{
- UART_S1_REG(UART3) &= ~UART_S1_IDLE_MASK;
-}

