📄 avrgsm__com_8h.html
字号:
<td> </td> <td><p>Return pointer to receive buffer. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>void</em> </td><td></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>rx_buffer</em> </td><td>Pointer to receive buffer </td></tr> </table></dl><p>Definition at line <a class="el" href="AVRGSM__com_8c-source.html#l00317">317</a> of file <a class="el" href="AVRGSM__com_8c-source.html">AVRGSM_com.c</a>.<p>References <a class="el" href="AVRGSM__com_8c-source.html#l00037">rx_buffer</a>.<p>Referenced by <a class="el" href="AVRGSM__tools_8c-source.html#l00080">TOOLS__decodeCMGR()</a>, and <a class="el" href="AVRGSM__tools_8c-source.html#l00039">TOOLS_decodeCMTI()</a>.<p><pre class="fragment"><div>00318 {00319 <span class="keywordflow">return</span> <a class="code" href="AVRGSM__com_8c.html#a2">rx_buffer</a>;00320 }</div></pre> </td> </tr></table><a class="anchor" name="a7" doxytag="AVRGSM_com.h::COM_init" ></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"> void COM_init </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">unsigned int </td> <td class="mdname1" valign="top" nowrap> <em>baudrate</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>USART0 initialization. <p>This function set correct baurate and functionality of the USART0. See data sheet for more details.<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>Desired baudrate...see datasheet</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>void</em> </td><td></td></tr> </table></dl><p>Definition at line <a class="el" href="AVRGSM__com_8c-source.html#l00066">66</a> of file <a class="el" href="AVRGSM__com_8c-source.html">AVRGSM_com.c</a>.<p>References <a class="el" href="AVRGSM__com_8c-source.html#l00085">COM_rx_reset()</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00206">Initialization()</a>.<p><pre class="fragment"><div>00067 {00068 00069 UBRR0H = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>) (baudrate>>8); <span class="comment">//Setting baudrate</span>00070 UBRR0L = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>) baudrate; <span class="comment">//Setting baudrate</span>00071 00072 UCSR0B = ( 1 << RXEN0 ) | ( 1 << TXEN0 ); <span class="comment">//Enable receiver and transmitter</span>00073 UCSR0C = ( 1 << USBS0 ) | ( 1 << UCSZ01 ) | ( 1 << UCSZ00 ); <span class="comment">//8N1...see Datasheet for more information</span>00074 00075 <a class="code" href="AVRGSM__com_8c.html#a13">COM_rx_reset</a>(); <span class="comment">//Reset buffers etc.</span>00076 }</div></pre><p>Here is the call graph for this function:<p><center><img src="AVRGSM__com_8h_a7_cgraph.png" border="0" usemap="#AVRGSM__com_8h_a7_cgraph_map" alt=""></center><map name="AVRGSM__com_8h_a7_cgraph_map"><area href="AVRGSM__com_8c.html#a13" shape="rect" coords="135,7,244,33" alt=""></map> </td> </tr></table><a class="anchor" name="a13" doxytag="AVRGSM_com.h::COM_put_integer" ></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"> void COM_put_integer </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname1" valign="top" nowrap> <em>i</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 method will print an integer in the range +-(10^5 - 1 ). <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>i</em> </td><td>integer to be printed</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>void</em> </td><td></td></tr> </table></dl><p>Local variables <p>Definition at line <a class="el" href="AVRGSM__com_8c-source.html#l00224">224</a> of file <a class="el" href="AVRGSM__com_8c-source.html">AVRGSM_com.c</a>.<p>References <a class="el" href="AVRGSM__com_8c-source.html#l00198">COM_putchar()</a>.<p>Referenced by <a class="el" href="AVRGSM__api_8c-source.html#l00125">API_deletemsg()</a>, <a class="el" href="AVRGSM__api_8c-source.html#l00232">API_readmsg()</a>, and <a class="el" href="AVRGSM__api_8c-source.html#l00160">API_sendmsg()</a>.<p><pre class="fragment"><div>00225 {00226 00228 <span class="keywordtype">int</span> ii;00229 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> int_buf[5];00230 00231 <span class="keywordflow">if</span> (i < 0) <span class="comment">//Integer is negative</span>00232 {00233 i = -i; <span class="comment">//Convert to positive Integer</span>00234 <a class="code" href="AVRGSM__com_8h.html#a12">COM_putchar</a>(<span class="charliteral">'-'</span>); <span class="comment">//Print - sign</span>00235 }00236 00237 <span class="keywordflow">for</span> (ii=0; ii < 5; ) <span class="comment">//Convert Integer to char array</span>00238 {00239 int_buf[ii++] = <span class="charliteral">'0'</span>+ i % 10; <span class="comment">//Find carry using modulo operation</span>00240 i = i / 10; <span class="comment">//Move towards MSB</span>00241 }00242 <span class="keywordflow">do</span>{ ii--; }<span class="keywordflow">while</span>( (int_buf[ii] == <span class="charliteral">'0'</span>) && (ii != 0) ); <span class="comment">//Remove leading 0's</span>00243 <span class="keywordflow">do</span>{ <a class="code" href="AVRGSM__com_8h.html#a12">COM_putchar</a>( int_buf[ii--] ); }<span class="keywordflow">while</span> (ii >= 0); <span class="comment">//Print int->char array convertion</span>00244 00245 }</div></pre><p>Here is the call graph for this function:<p><center><img src="AVRGSM__com_8h_a13_cgraph.png" border="0" usemap="#AVRGSM__com_8h_a13_cgraph_map" alt=""></center><map name="AVRGSM__com_8h_a13_cgraph_map"><area href="AVRGSM__com_8h.html#a12" shape="rect" coords="184,7,288,33" alt=""></map> </td> </tr></table><a class="anchor" name="a12" doxytag="AVRGSM_com.h::COM_putchar" ></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"> int COM_putchar </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">unsigned char </td> <td class="mdname1" valign="top" nowrap> <em>data</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>Adapted putchar method...no need for interrup driven tx-isr. <p>Adpation of ansi c putchar() method<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>data</em> </td><td>Character to send</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>data</em> </td><td>if successful </td></tr> <tr><td></td><td valign=top><em>-1</em> </td><td>if timeout </td></tr> </table></dl><p>Definition at line <a class="el" href="AVRGSM__com_8c-source.html#l00198">198</a> of file <a class="el" href="AVRGSM__com_8c-source.html">AVRGSM_com.c</a>.<p>References <a class="el" href="AVRGSM__com_8h-source.html#l00028">RX_WAIT</a>.<p>Referenced by <a class="el" href="AVRGSM__api_8c-source.html#l00160">API_sendmsg()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00224">COM_put_integer()</a>, <a class="el" href="AVRGSM__com_8c-source.html#l00254">COM_puts()</a>, and <a class="el" href="AVRGSM__com_8c-source.html#l00270">COM_putsf()</a>.<p><pre class="fragment"><div>00199 {00200 00201 <span class="comment">//Local variables</span>00202 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;00203 00204 <span class="keywordflow">for</span>( i = 0; !( UCSR0A & ( 1 << UDRE0 ) ); i++ ) <span class="comment">// Wait for empty transmit buffer</span>00205 {00206 <span class="keywordflow">if</span>( i > <a class="code" href="AVRGSM__com_8h.html#a2">RX_WAIT</a> ) <span class="comment">//How long one should wait</span>00207 {00208 <span class="keywordflow">return</span> -1; <span class="comment">//Give feedback to function caller</span>00209 }00210 }00211 00212 UDR0 = data; <span class="comment">// Start transmittion </span>00213 00214 <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)data; <span class="comment">//Cast and return int value</span>00215 }</div></pre> </td> </tr></table><a class="anchor" name="a14" doxytag="AVRGSM_com.h::COM_puts" ></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"> void COM_puts </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">unsigned char * </td> <td class="mdname1" valign="top" nowrap> <em>str</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>Print unsigned char string. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>str</em> </td><td>Pointer to the string</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>void</em> </td><td></td></tr> </table></dl><p>Definition at line <a class="el" href="AVRGSM__com_8c-source.html#l00254">254</a> of file <a class="el" href="AVRGSM__com_8c-source.html">AVRGSM_com.c</a>.<p>References <a class="el" href="AVRGSM__com_8c-source.html#l00198">COM_putchar()</a>.<p>Referenced by <a class="el" href="AVRGSM__api_8c-source.html#l00160">API_sendmsg()</a>.<p><pre class="fragment"><div>00255 {00256 00257 <span class="keywordflow">for</span>( ;*str != <span class="charliteral">'\0'</span>; )00258 {00259 <a class="code" href="AVRGSM__com_8h.html#a12">COM_putchar</a>( *str++ );00260 }00261 }</div></pre><p>Here is the call graph for this function:<p><center><img src="AVRGSM__com_8h_a14_cgraph.png" border="0" usemap="#AVRGSM__com_8h_a14_cgraph_map" alt=""></center><map name="AVRGSM__com_8h_a14_cgraph_map"><area href="AVRGSM__com_8h.html#a12" shape="rect" coords="141,7,245,33" alt=""></map> </td> </tr></table><a class="anchor" name="a15" doxytag="AVRGSM_com.h::COM_putsf" ></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"> void COM_putsf </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const unsigned char __flash * </td> <td class="mdname1" valign="top" nowrap> <em>fstr</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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -