DCS_TEAM / DPG_FINAL

Dependents:   DCS_FINAL_CODE

Fork of GSM_PUSHING_BOX_STATE_MACHINE by DCS_TEAM

Revision:
0:41904adca656
Child:
2:8352ad91f2ee
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GSMLibrary.h	Thu Mar 05 20:06:41 2015 +0000
@@ -0,0 +1,35 @@
+#ifndef GSMLIBRARY_H
+#define GSMLIBRARY_H
+
+#include "mbed.h"
+
+#define GSM_TRANSMISSION_COMPLETE ((UART_S1_IDLE_MASK & UART_S1_REG(UART3)) >> UART_S1_IDLE_SHIFT)
+
+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_CMGF,    //prepare phone to send message by CMGF=1
+                    GSM_AT_CMGS,    //input phone number by CMGS= "+phonenumber"
+                    GSM_AT_SENDSMS, //write message, finish with alt+z
+                    GSM_SUCCESS     //check if message was send correctly
+                };
+
+
+//GSM state machine
+void gsm_tick();
+
+//Initialize DMA data transfer, and UART3.
+void gsm_initialize();
+
+//begin message transmission
+void start();
+
+//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.
+void reset();
+
+//used for debuging purposes, it print all main registers from dma0 and uart3
+void print_registers(); 
+
+#endif
\ No newline at end of file