uses pushing box to publish to google spreadsheets with a state machine instead of a while loop

Fork of GSM_Library by DCS_TEAM

Committer:
DeWayneDennis
Date:
Wed Oct 21 19:44:15 2015 +0000
Revision:
32:424896b5adbe
Parent:
31:a1e9fd23eb6a
added GSM Library;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
danilob 0:41904adca656 1 #ifndef GSMLIBRARY_H
danilob 0:41904adca656 2 #define GSMLIBRARY_H
danilob 0:41904adca656 3
danilob 0:41904adca656 4 #include "mbed.h"
es_marble 24:7d2ff444d6d8 5
es_marble 31:a1e9fd23eb6a 6 #define TIME_CONST 1 //Specify length of each GSM tick (currently called twice every 2 seconds, so an average of every 1 second)
es_marble 24:7d2ff444d6d8 7 #define SECONDS_TIMEOUT 30
es_marble 29:bc5f53f2922a 8 #define SMS_END_CHAR "\x1A" //Character that must be appended to end of text message before it will be sent
es_marble 29:bc5f53f2922a 9 #define SMS_ESCAPE_CHAR "\x1A" //Character that can be appended to end of text message to abort sending it
danilob 0:41904adca656 10
danilob 0:41904adca656 11 enum gsm_states{GSM_INITIALIZE,
DeWayneDennis 32:424896b5adbe 12 GSM_CHECK_SIM, //Send initial AT Command and Check SIM Card Status
DeWayneDennis 32:424896b5adbe 13 GSM_JOIN, //Join the wireless network
DeWayneDennis 32:424896b5adbe 14 GSM_SERVER_IP, //Get the IP Address for the server
DeWayneDennis 32:424896b5adbe 15 GSM_CONNECT, //Connect to the server via tcp on specified port
DeWayneDennis 32:424896b5adbe 16 GSM_SEND, //Send data to server via tcp
DeWayneDennis 32:424896b5adbe 17 GSM_WAIT //State to wait between successive data sent to the server
danilob 0:41904adca656 18 };
danilob 0:41904adca656 19
danilob 0:41904adca656 20 //GSM state machine
danilob 0:41904adca656 21 void gsm_tick();
es_marble 16:6807d437cd48 22 bool gsm_timeOut();
es_marble 24:7d2ff444d6d8 23 void gsm_printState();
es_marble 16:6807d437cd48 24 void gsm_nextStateLogic();
danilob 0:41904adca656 25
danilob 0:41904adca656 26 //Initialize DMA data transfer, and UART3.
danilob 0:41904adca656 27 void gsm_initialize();
danilob 0:41904adca656 28
es_marble 29:bc5f53f2922a 29 //returns 1 for ready to send again, 0 for busy.
danilob 17:360afa1e6809 30 bool gsm_ready();
danilob 17:360afa1e6809 31
es_marble 24:7d2ff444d6d8 32 //Have the GSM send data - L = long, S = short, hh/mm/ss for time, "lat ns" for latitute, "lon we" for longitude
DeWayneDennis 32:424896b5adbe 33 void gsm_send_data(float L, float Lref, int hh, int mm, int ss, float lat, char ns, float lon, char we);
danilob 0:41904adca656 34
es_marble 29:bc5f53f2922a 35 //Brings state machine back to initialize state (notice this is a bit different than the initialize function)
es_marble 29:bc5f53f2922a 36 //This will set flags to their initial values and prepare gsm to start anew.
es_marble 24:7d2ff444d6d8 37 void gsm_reset();
danilob 0:41904adca656 38
es_marble 29:bc5f53f2922a 39 //For debugging: print registers related to DMA and UART setup
es_marble 29:bc5f53f2922a 40 void print_registers();
danilob 0:41904adca656 41
danilob 0:41904adca656 42 #endif