📄 state__functions_8c.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: STATE_functions.c File Reference</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 File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>Atmel Corporation<p><ul><li>File : <a class="el" href="STATE__functions_8c.html">STATE_functions.c</a></li><li>Compiler : IAR EWAAVR 4.11a</li></ul><p><ul><li>Support mail : <a href="mailto:avr@atmel.com">avr@atmel.com</a></li></ul><p><ul><li>Supported devices : All devices with a UART/USART can be used. The example is written for ATmega169</li></ul><p><ul><li>AppNote : AVR323 - Interfacing GSM modems</li></ul><p><ul><li>Description : Example of how to use AT-Commands to control a GSM modem</li></ul><p><dl compact><dt><b>Revision</b></dt><dd>1.2 </dd></dl><dl compact><dt><b>Date</b></dt><dd>Wednesday, January 26, 2005 10:43:44 UTC </dd></dl><p>Definition in file <a class="el" href="STATE__functions_8c-source.html">STATE_functions.c</a>.<p><code>#include <ioavr.h></code><br><code>#include <inavr.h></code><br><code>#include "<a class="el" href="main_8h-source.html">main.h</a>"</code><br><code>#include "LCD_functions.h"</code><br><code>#include "<a class="el" href="AVRGSM__api_8h-source.html">..\AVRGSM_FILES\AVRGSM_api.h</a>"</code><br><code>#include "<a class="el" href="AVRGSM__com_8h-source.html">..\AVRGSM_FILES\AVRGSM_com.h</a>"</code><br><code>#include "<a class="el" href="AVRGSM__tools_8h-source.html">..\AVRGSM_FILES\AVRGSM_tools.h</a>"</code><br><p>Include dependency graph for STATE_functions.c:<p><center><img src="STATE__functions_8c__incl.png" border="0" usemap="#STATE_functions.c_map" alt="Include dependency graph"></center><map name="STATE_functions.c_map"><area href="main_8h.html" shape="rect" coords="99,108,160,135" alt=""><area href="AVRGSM__api_8h.html" shape="rect" coords="14,209,246,236" alt=""><area href="AVRGSM__com_8h.html" shape="rect" coords="10,260,250,287" alt=""><area href="AVRGSM__tools_8h.html" shape="rect" coords="8,311,251,337" alt=""></map><p><a href="STATE__functions_8c-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>char </td><td class="memItemRight" valign=bottom><a class="el" href="STATE__functions_8c.html#a4">ST_delete_msg</a> (char <a class="el" href="main_8h.html#a27">input</a>)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">This function will delete the newly arrived message. <a href="#a4"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>char </td><td class="memItemRight" valign=bottom><a class="el" href="STATE__functions_8c.html#a5">ST_get_index</a> (char <a class="el" href="main_8h.html#a27">input</a>)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">This function extract the storage location of the newly arrived message. <a href="#a5"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>char </td><td class="memItemRight" valign=bottom><a class="el" href="STATE__functions_8c.html#a2">ST_init_phone</a> (char <a class="el" href="main_8h.html#a27">input</a>)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Init phone. <a href="#a2"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>char </td><td class="memItemRight" valign=bottom><a class="el" href="STATE__functions_8c.html#a6">ST_read</a> (char <a class="el" href="main_8h.html#a27">input</a>)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">This function will read message at memory location index. <a href="#a6"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>char </td><td class="memItemRight" valign=bottom><a class="el" href="STATE__functions_8c.html#a3">ST_send</a> (char <a class="el" href="main_8h.html#a27">input</a>)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">This function will send a user defined text string. <a href="#a3"></a><br><br></td></tr><tr><td colspan=2><br><h2>Variables</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="STATE__functions_8c.html#a0">index</a></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char </td><td class="memItemRight" valign=bottom><a class="el" href="STATE__functions_8c.html#a1">msgbuff</a> [161]</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Message buffer for coded and decoded messages. <a href="#a1"></a><br><br></td></tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="a4" doxytag="STATE_functions.c::ST_delete_msg" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> char ST_delete_msg </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char </td> <td class="mdname1" valign="top" nowrap> <em>input</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>This function will delete the newly arrived message. <p>State function<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>input</em> </td><td>Dummy input...joypad value.</td></tr> </table></dl><dl compact><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>char</em> </td><td>Next state. </td></tr> </table></dl><p>Definition at line <a class="el" href="STATE__functions_8c-source.html#l00118">118</a> of file <a class="el" href="STATE__functions_8c-source.html">STATE_functions.c</a>.<p>References <a class="el" href="AVRGSM__api_8c-source.html#l00125">API_deletemsg()</a>, <a class="el" href="AVRGSM__com_8h-source.html#l00030">CMTI_</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00101">COM_rx_on()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00085">COM_rx_reset()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00127">COM_setSearchString()</a>, <a class="el" href="STATE__functions_8c-source.html#l00036">index</a>, and <a class="el" href="main_8h.html#a26a4">ST_AVR_READY</a>.<p><pre class="fragment"><div>00119 {00120 <a class="code" href="AVRGSM__api_8h.html#a1">API_deletemsg</a>( index );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>( CMTI_ ); <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 }</div></pre><p>Here is the call graph for this function:<p><center><img src="STATE__functions_8c_a4_cgraph.png" border="0" usemap="#STATE__functions_8c_a4_cgraph_map" alt=""></center><map name="STATE__functions_8c_a4_cgraph_map"><area href="AVRGSM__api_8h.html#a1" shape="rect" coords="172,209,287,236" alt=""><area href="AVRGSM__com_8c.html#a13" shape="rect" coords="556,57,665,84" alt=""><area href="AVRGSM__com_8c.html#a14" shape="rect" coords="375,260,468,287" alt=""><area href="AVRGSM__com_8h.html#a11" shape="rect" coords="344,311,499,337" alt=""><area href="AVRGSM__api_8c.html#a9" shape="rect" coords="336,108,507,135" alt=""><area href="AVRGSM__com_8h.html#a13" shape="rect" coords="357,159,485,185" alt=""><area href="AVRGSM__com_8h.html#a15" shape="rect" coords="376,209,467,236" alt=""><area href="AVRGSM__com_8c.html#a15" shape="rect" coords="564,108,657,135" alt=""><area href="AVRGSM__com_8h.html#a12" shape="rect" coords="559,184,663,211" alt=""></map> </td> </tr></table><a class="anchor" name="a5" doxytag="STATE_functions.c::ST_get_index" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> char ST_get_index </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char </td> <td class="mdname1" valign="top" nowrap> <em>input</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>This function extract the storage location of the newly arrived message. <p>State function<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>input</em> </td><td>Dummy input...joypad value.</td></tr> </table></dl><dl compact><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>char</em> </td><td>Next state. </td></tr> </table></dl><p>Definition at line <a class="el" href="STATE__functions_8c-source.html#l00141">141</a> of file <a class="el" href="STATE__functions_8c-source.html">STATE_functions.c</a>.<p>References <a class="el" href="STATE__functions_8c-source.html#l00036">index</a>, <a class="el" href="main_8h.html#a26a8">ST_AVR_NEW_SMS</a>, and <a class="el" href="AVRGSM__tools_8c-source.html#l00039">TOOLS_decodeCMTI()</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00084">main()</a>.<p><pre class="fragment"><div>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 }</div></pre><p>Here is the call graph for this function:<p><center><img src="STATE__functions_8c_a5_cgraph.png" border="0" usemap="#STATE__functions_8c_a5_cgraph_map" alt=""></center><map name="STATE__functions_8c_a5_cgraph_map"><area href="AVRGSM__tools_8c.html#a0" shape="rect" coords="161,57,313,84" alt=""><area href="AVRGSM__com_8c.html#a23" shape="rect" coords="361,7,447,33" alt=""><area href="AVRGSM__com_8c.html#a22" shape="rect" coords="363,57,445,84" alt=""><area href="AVRGSM__zip_8h.html#a5" shape="rect" coords="368,108,440,135" alt=""></map> </td> </tr></table><a class="anchor" name="a2" doxytag="STATE_functions.c::ST_init_phone" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> char ST_init_phone </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char </td> <td class="mdname1" valign="top" nowrap> <em>input</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Init phone. <p>State function<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>input</em> </td><td>Dummy input...joypad value.</td></tr> </table></dl><dl compact><dt><b>Return values:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>char</em> </td><td>Next state. </td></tr> </table></dl><p>Definition at line <a class="el" href="STATE__functions_8c-source.html#l00051">51</a> of file <a class="el" href="STATE__functions_8c-source.html">STATE_functions.c</a>.<p>References <a class="el" href="AVRGSM__api_8c-source.html#l00073">API_modem_init()</a>, <a class="el" href="AVRGSM__com_8h-source.html#l00030">CMTI_</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00101">COM_rx_on()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00085">COM_rx_reset()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00127">COM_setSearchString()</a>, <a class="el" href="main_8h.html#a26a5">ST_AVR_NO_ECHO</a>, <a class="el" href="main_8h.html#a26a4">ST_AVR_READY</a>, <a class="el" href="main_8h.html#a26a7">ST_AVR_WRONG_OPTION</a>, and <a class="el" href="main_8h.html#a26a6">ST_AVR_WRONG_STORAGE</a>.<p><pre class="fragment"><div>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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -