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: GSMLibrary.h
- Revision:
- 29:bc5f53f2922a
- Parent:
- 24:7d2ff444d6d8
- Child:
- 31:a1e9fd23eb6a
--- a/GSMLibrary.h Thu Apr 23 02:06:55 2015 +0000 +++ b/GSMLibrary.h Sat Apr 25 15:39:00 2015 +0000 @@ -3,21 +3,21 @@ #include "mbed.h" -#define TIME_CONST 1 +#define TIME_CONST 2 //Specify length of each GSM tick (currently 1.8 seconds but we rounded up to 2 to simplify calculations) #define SECONDS_TIMEOUT 30 -#define SMS_END_CHAR "\x1A" -#define SMS_ESCAPE_CHAR "\x1A" +#define SMS_END_CHAR "\x1A" //Character that must be appended to end of text message before it will be sent +#define SMS_ESCAPE_CHAR "\x1A" //Character that can be appended to end of text message to abort sending it enum gsm_states{GSM_INITIALIZE, - GSM_AT_OK, //Make sure communication is stablished betheen fdm and gsm - GSM_AT_CSQ, //Check signal strength if strenght lower than 10 keep trying - GSM_AT_CREG, //Checking if phone is conected to network + GSM_AT_OK, //Make sure communication is established with GSM + GSM_AT_CSQ, //Check signal strength + GSM_AT_CREG, //Check if phone is connected to network GSM_AT_CNMI, //Turn off incoming SMS notifications - GSM_AT_CMGF, //prepare phone to send message by CMGF=1 - GSM_READ_MSG, //check for a new message. if so will set transmitter mode on. - GSM_AT_CMGS, //input phone number by CMGS= "+phonenumber" - GSM_AT_SENDSMS, //write message, finish with alt+z - GSM_DEL_R_MSGS //delete unread messages (if present) + GSM_AT_CMGF, //Change to text message mode + GSM_READ_MSG, //Check for new messages. + GSM_AT_CMGS, //Input phone number and indicate beginning of SMS message body + GSM_AT_SENDSMS, //Write message, finish with SMS_END_CHAR + GSM_DEL_R_MSGS //Delete unread messages (if present) }; //GSM state machine @@ -30,17 +30,17 @@ //Initialize DMA data transfer, and UART3. void gsm_initialize(); -//returns 1 for eady to send again, 0 for busy. +//returns 1 for ready to send again, 0 for busy. bool gsm_ready(); //Have the GSM send data - L = long, S = short, hh/mm/ss for time, "lat ns" for latitute, "lon we" for longitude void gsm_send_data(float L, float Lref, float S, float Sref, int hh, int mm, int ss, float lat, char ns, float lon, char we); -//Brings state machine back to initialize state (notice this is different than initialize function) -//this will set flags to initial values and prepare gsm to work anew. +//Brings state machine back to initialize state (notice this is a bit different than the initialize function) +//This will set flags to their initial values and prepare gsm to start anew. void gsm_reset(); -//used for debuging purposes, it print all main registers from dma0 and uart3 -void print_registers(); +//For debugging: print registers related to DMA and UART setup +void print_registers(); #endif \ No newline at end of file