📄 state__functions_8c-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>AVR323 Interfacing GSM modems: ATAVRBFLY_FILES/STATE_functions.c Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.7 --><div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>ATAVRBFLY_FILES/STATE_functions.c</h1><a href="STATE__functions_8c.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">// This file has been prepared for Doxygen automatic documentation generation.</span>00023 <span class="comment"></span><span class="comment">//Includes</span>00024 <span class="preprocessor">#include<ioavr.h></span>00025 <span class="preprocessor">#include<inavr.h></span>00026 00027 <span class="preprocessor">#include"<a class="code" href="main_8h.html">main.h</a>"</span>00028 <span class="preprocessor">#include"LCD_functions.h"</span>00029 00030 <span class="preprocessor">#include"..\AVRGSM_FILES\AVRGSM_api.h"</span>00031 <span class="preprocessor">#include"..\AVRGSM_FILES\AVRGSM_com.h"</span>00032 <span class="preprocessor">#include"..\AVRGSM_FILES\AVRGSM_tools.h"</span>00033 00034 00035 <span class="comment">//Variables</span><a name="l00036"></a><a class="code" href="STATE__functions_8c.html#a0">00036</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="STATE__functions_8c.html#a0">index</a>; <span class="comment">//Index to read from</span>00037 <a name="l00038"></a><a class="code" href="STATE__functions_8c.html#a1">00038</a> <span class="keyword">extern</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="AVRGSM__api_8c.html#a1">msgbuff</a>[161];00039 00040 00041 <span class="comment">//Functions</span><a name="l00051"></a><a class="code" href="STATE__functions_8h.html#a0">00051</a> <span class="comment"></span><span class="keywordtype">char</span> <a class="code" href="STATE__functions_8h.html#a0">ST_init_phone</a>(<span class="keywordtype">char</span> input)00052 {00053 <span class="comment">//Local variables</span>00054 <span class="keywordtype">int</span> result;00055 00056 <span class="comment">//Initialization</span>00057 result = 0;00058 00059 result = <a class="code" href="AVRGSM__api_8c.html#a10">API_modem_init</a>(); <span class="comment">//Setup phone</span>00060 00061 <span class="keywordflow">if</span>( result == 1 )00062 {00063 00064 <a class="code" href="AVRGSM__com_8c.html#a13">COM_rx_reset</a>( ); <span class="comment">//Reset receive buffer after API_phoneinit()</span>00065 <a class="code" href="AVRGSM__com_8h.html#a11">COM_setSearchString</a>( <a class="code" href="AVRGSM__com_8h.html#a4">CMTI_</a> ); <span class="comment">//Wait for "+CMTI: ,Storage,index\r\n"</span>00066 <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( ); <span class="comment">//Ready to receive</span>00067 00068 <span class="keywordflow">return</span> <a class="code" href="main_8h.html#a26a4">ST_AVR_READY</a>;00069 }00070 00071 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( result == 0 )00072 {00073 00074 <span class="keywordflow">return</span> <a class="code" href="main_8h.html#a26a5">ST_AVR_NO_ECHO</a>; <span class="comment">//Could not set echo off</span>00075 }00076 00077 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( result == -1 )00078 {00079 00080 <span class="keywordflow">return</span> <a class="code" href="main_8h.html#a26a6">ST_AVR_WRONG_STORAGE</a>; <span class="comment">//No such storage locations</span>00081 }00082 00083 <span class="keywordflow">else</span>00084 {00085 00086 <span class="keywordflow">return</span> <a class="code" href="main_8h.html#a26a7">ST_AVR_WRONG_OPTION</a>; <span class="comment">//The chosen forward option is not valid for this GSM modem</span>00087 }00088 }00089 00090 <a name="l00100"></a><a class="code" href="STATE__functions_8h.html#a4">00100</a> <span class="keywordtype">char</span> <a class="code" href="STATE__functions_8h.html#a4">ST_send</a>(<span class="keywordtype">char</span> input)00101 {00102 00103 <a class="code" href="AVRGSM__api_8h.html#a2">API_sendmsg</a>(<span class="stringliteral">"ATMEL AVR"</span>);00104 00105 <span class="keywordflow">return</span> <a class="code" href="main_8h.html#a26a4">ST_AVR_READY</a>;00106 }00107 00108 <a name="l00118"></a><a class="code" href="STATE__functions_8h.html#a2">00118</a> <span class="keywordtype">char</span> <a class="code" href="STATE__functions_8h.html#a2">ST_delete_msg</a>( <span class="keywordtype">char</span> input )00119 {00120 <a class="code" href="AVRGSM__api_8h.html#a1">API_deletemsg</a>( <a class="code" href="STATE__functions_8c.html#a0">index</a> );00121 00122 <a class="code" href="STATE__functions_8c.html#a0">index</a> = 0;00123 00124 <a class="code" href="AVRGSM__com_8c.html#a13">COM_rx_reset</a>( ); <span class="comment">//Reset receive buffer after API_phoneinit()</span>00125 <a class="code" href="AVRGSM__com_8h.html#a11">COM_setSearchString</a>( <a class="code" href="AVRGSM__com_8h.html#a4">CMTI_</a> ); <span class="comment">//Wait for "+CMTI: ,Storage,index\r\n"</span>00126 <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( ); <span class="comment">//Ready to receive</span>00127 00128 <span class="keywordflow">return</span> <a class="code" href="main_8h.html#a26a4">ST_AVR_READY</a>;00129 }00130 00131 <a name="l00141"></a><a class="code" href="STATE__functions_8h.html#a1">00141</a> <span class="keywordtype">char</span> <a class="code" href="STATE__functions_8h.html#a1">ST_get_index</a>( <span class="keywordtype">char</span> input )00142 {00143 00144 <a class="code" href="STATE__functions_8c.html#a0">index</a> = <a class="code" href="AVRGSM__tools_8c.html#a0">TOOLS_decodeCMTI</a>( ); <span class="comment">//Find index</span>00145 <span class="keywordflow">return</span> <a class="code" href="main_8h.html#a26a8">ST_AVR_NEW_SMS</a>;00146 }00147 00148 <a name="l00158"></a><a class="code" href="STATE__functions_8h.html#a3">00158</a> <span class="keywordtype">char</span> <a class="code" href="STATE__functions_8h.html#a3">ST_read</a>( <span class="keywordtype">char</span> input )00159 {00160 00161 <a class="code" href="AVRGSM__api_8h.html#a3">API_readmsg</a>( <a class="code" href="STATE__functions_8c.html#a0">index</a> ); <span class="comment">//Read new message, and decode</span>00162 <a class="code" href="Lcd__functions_8h.html#a1">LCD_puts</a>((<span class="keywordtype">char</span> *)<a class="code" href="AVRGSM__api_8c.html#a1">msgbuff</a>,1); <span class="comment">//Cast pointer</span>00163 00164 <a class="code" href="AVRGSM__com_8h.html#a11">COM_setSearchString</a>( 1 ); <span class="comment">//Set searchstring to "+CMTI: " again, wait for new message.</span>00165 <a class="code" href="AVRGSM__com_8c.html#a13">COM_rx_reset</a>( ); <span class="comment">//Reset buffer and interrupt routine</span>00166 <a class="code" href="AVRGSM__com_8c.html#a14">COM_rx_on</a>( ); <span class="comment">//Ready to receive*/</span>00167 00168 <span class="keywordflow">return</span> <a class="code" href="main_8h.html#a26a14">ST_AVR_DISPLAY</a>;00169 }</div></pre><hr size="1"><address style="align: right;"><small>Generated on Tue Nov 1 16:21:39 2005 for AVR323 Interfacing GSM modems by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -