uses pushing box to publish to google spreadsheets with a state machine instead of a while loop
Fork of GSM_PUSHING_BOX_STATE_MACHINE by
Diff: gsmqueue.cpp
- Revision:
- 29:bc5f53f2922a
- Parent:
- 27:fe1c7eaf5b88
- Child:
- 32:424896b5adbe
--- 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; -}