DCS_TEAM / GSM_Library

Fork of GSM_Library by Danilo Bustamante

GSMLibrary.h

Committer:
danilob
Date:
2015-03-24
Revision:
23:5227fb014aad
Parent:
22:a5adf9331032
Child:
24:7d2ff444d6d8

File content as of revision 23:5227fb014aad:

#ifndef GSMLIBRARY_H
#define GSMLIBRARY_H

#include "mbed.h"
#define MAX_MSG_SIZE 1000

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();
bool gsm_timeOut();
void gsm_nextStateLogic();
void gsm_mealyOutputs();

//Initialize DMA data transfer, and UART3.
void gsm_initialize();

//returns 1 for eady to send again, 0 for busy.
bool gsm_ready();

//begin message transmission
void gsm_send_sms(char message[]);

//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