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
GSMLibrary.h@23:5227fb014aad, 2015-03-24 (annotated)
- Committer:
- danilob
- Date:
- Tue Mar 24 18:39:13 2015 +0000
- Revision:
- 23:5227fb014aad
- Parent:
- 22:a5adf9331032
- Child:
- 24:7d2ff444d6d8
we fixed gsm all shpuld be work correctly. Gsm at ok loop message size problem
Who changed what in which revision?
User | Revision | Line number | New 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" |
danilob | 23:5227fb014aad | 5 | #define MAX_MSG_SIZE 1000 |
danilob | 0:41904adca656 | 6 | |
danilob | 0:41904adca656 | 7 | enum gsm_states{GSM_INITIALIZE, |
danilob | 0:41904adca656 | 8 | GSM_AT_OK, //Make sure communication is stablished betheen fdm and gsm |
danilob | 0:41904adca656 | 9 | GSM_AT_CSQ, //Check signal strength if strenght lower than 10 keep trying |
danilob | 0:41904adca656 | 10 | GSM_AT_CREG, //Checking if phone is conected to network |
danilob | 0:41904adca656 | 11 | GSM_AT_CMGF, //prepare phone to send message by CMGF=1 |
danilob | 0:41904adca656 | 12 | GSM_AT_CMGS, //input phone number by CMGS= "+phonenumber" |
danilob | 0:41904adca656 | 13 | GSM_AT_SENDSMS, //write message, finish with alt+z |
danilob | 0:41904adca656 | 14 | GSM_SUCCESS //check if message was send correctly |
danilob | 0:41904adca656 | 15 | }; |
danilob | 0:41904adca656 | 16 | |
danilob | 0:41904adca656 | 17 | |
danilob | 0:41904adca656 | 18 | //GSM state machine |
danilob | 0:41904adca656 | 19 | void gsm_tick(); |
es_marble | 16:6807d437cd48 | 20 | bool gsm_timeOut(); |
es_marble | 16:6807d437cd48 | 21 | void gsm_nextStateLogic(); |
es_marble | 16:6807d437cd48 | 22 | void gsm_mealyOutputs(); |
danilob | 0:41904adca656 | 23 | |
danilob | 0:41904adca656 | 24 | //Initialize DMA data transfer, and UART3. |
danilob | 0:41904adca656 | 25 | void gsm_initialize(); |
danilob | 0:41904adca656 | 26 | |
danilob | 17:360afa1e6809 | 27 | //returns 1 for eady to send again, 0 for busy. |
danilob | 17:360afa1e6809 | 28 | bool gsm_ready(); |
danilob | 17:360afa1e6809 | 29 | |
danilob | 0:41904adca656 | 30 | //begin message transmission |
danilob | 17:360afa1e6809 | 31 | void gsm_send_sms(char message[]); |
danilob | 0:41904adca656 | 32 | |
danilob | 0:41904adca656 | 33 | //Brings state machine back to initialize state (notice this is different than initialize function) |
danilob | 0:41904adca656 | 34 | //this will set flags to initial values and prepare gsm to work anew. |
danilob | 0:41904adca656 | 35 | void reset(); |
danilob | 0:41904adca656 | 36 | |
danilob | 0:41904adca656 | 37 | //used for debuging purposes, it print all main registers from dma0 and uart3 |
danilob | 0:41904adca656 | 38 | void print_registers(); |
danilob | 0:41904adca656 | 39 | |
danilob | 0:41904adca656 | 40 | #endif |