works through pushing box to log data to google spreadsheet

Dependencies:   MBed_Adafruit-GPS-Library SDFileSystem mbed

Fork of GPR_Interface by DCS_TEAM

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GSMLibrary.h Source File

GSMLibrary.h

00001 #ifndef GSMLIBRARY_H
00002 #define GSMLIBRARY_H
00003 
00004 #include "mbed.h"
00005 
00006 #define TIME_CONST 1    //Specify length of each GSM tick (currently 1 seconds in our debugger)
00007 #define SECONDS_TIMEOUT 30
00008 #define SMS_END_CHAR "\x1A"     //Character that must be appended to end of text message before it will be sent
00009 #define SMS_ESCAPE_CHAR "\x1A"  //Character that can be appended to end of text message to abort sending it
00010 
00011 enum gsm_states{GSM_INITIALIZE, 
00012                     GSM_AT_OK,      //Make sure communication is established with GSM
00013                     GSM_AT_CSQ,     //Check signal strength
00014                     GSM_AT_CREG,    //Check if phone is connected to network
00015                     GSM_AT_CNMI,    //Turn off incoming SMS notifications
00016                     GSM_AT_CMGF,    //Change to text message mode
00017                     GSM_READ_MSG,   //Check for new messages.
00018                     GSM_AT_CMGS,    //Input phone number and indicate beginning of SMS message body
00019                     GSM_AT_SENDSMS, //Write message, finish with SMS_END_CHAR
00020                     GSM_DEL_R_MSGS  //Delete unread messages (if present)   
00021                 };
00022 
00023 //GSM state machine
00024 void gsm_tick();
00025 bool gsm_timeOut();
00026 void gsm_printState();
00027 void gsm_nextStateLogic();
00028 void gsm_mealyOutputs();
00029 
00030 //Initialize DMA data transfer, and UART3.
00031 void gsm_initialize();
00032 
00033 //returns 1 for ready to send again, 0 for busy.
00034 bool gsm_ready();
00035 
00036 //Have the GSM send data - L = long, S = short, hh/mm/ss for time, "lat ns" for latitute, "lon we" for longitude
00037 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);
00038 
00039 //Brings state machine back to initialize state (notice this is a bit different than the initialize function)
00040 //This will set flags to their initial values and prepare gsm to start anew.
00041 void gsm_reset();
00042 
00043 //For debugging: print registers related to DMA and UART setup
00044 void print_registers();
00045 
00046 #endif