⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usart__example_8c.html.svn-base

📁 avr32100.zip Embedded demo
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
<!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>AVR32100 Communication with the AVR32 USART: usart_example.c File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.4 --><div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>usart_example.c File Reference</h1><p><code>#include &quot;<a class="el" href="usart_8h-source.html">usart.h</a>&quot;</code><br><p>Include dependency graph for usart_example.c:<p><center><img src="usart__example_8c__incl.png" border="0" usemap="#usart_example.c_map" alt=""></center><map name="usart_example.c_map"><area href="usart_8h.html" shape="rect" coords="179,7,240,33" alt=""></map><p><a href="usart__example_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>Defines</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="usart__example_8c.html#a1">FAILURE</a>&nbsp;&nbsp;&nbsp;-1;</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="usart__example_8c.html#a0">SUCCESS</a>&nbsp;&nbsp;&nbsp;0;</td></tr><tr><td colspan="2"><br><h2>Typedefs</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">typedef unsigned char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="usart__example_8c.html#a2">avr32_piomap_t</a> [][2]</td></tr><tr><td colspan="2"><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="usart__example_8c.html#a5">main</a> (void)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="usart__example_8c.html#a4">pio_enable_module</a> (<a class="el" href="usart__example_8c.html#a2">avr32_piomap_t</a> piomap, unsigned int size)</td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="usart__example_8c.html#a3">print</a> (volatile struct avr32_usart_t *usart, char *str)</td></tr></table><hr><h2>Define Documentation</h2><a class="anchor" name="a1"></a><!-- doxytag: member="usart_example.c::FAILURE" ref="a1" args="" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">#define FAILURE&nbsp;&nbsp;&nbsp;-1;          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p><p>Definition at line <a class="el" href="usart__example_8c-source.html#l00040">40</a> of file <a class="el" href="usart__example_8c-source.html">usart_example.c</a>.<p>Referenced by <a class="el" href="usart__example_8c-source.html#l00107">pio_enable_module()</a>.    </td>  </tr></table><a class="anchor" name="a0"></a><!-- doxytag: member="usart_example.c::SUCCESS" ref="a0" args="" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">#define SUCCESS&nbsp;&nbsp;&nbsp;0;          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p><p>Definition at line <a class="el" href="usart__example_8c-source.html#l00039">39</a> of file <a class="el" href="usart__example_8c-source.html">usart_example.c</a>.<p>Referenced by <a class="el" href="usart__example_8c-source.html#l00068">main()</a>, and <a class="el" href="usart__example_8c-source.html#l00107">pio_enable_module()</a>.    </td>  </tr></table><hr><h2>Typedef Documentation</h2><a class="anchor" name="a2"></a><!-- doxytag: member="usart_example.c::avr32_piomap_t" ref="a2" args="[][2]" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">typedef unsigned char <a class="el" href="usart__example_8c.html#a2">avr32_piomap_t</a>[][2]          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p><p>Definition at line <a class="el" href="usart__example_8c-source.html#l00050">50</a> of file <a class="el" href="usart__example_8c-source.html">usart_example.c</a>.    </td>  </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="a5"></a><!-- doxytag: member="usart_example.c::main" ref="a5" args="(void)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">int main           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">void&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p><p>Definition at line <a class="el" href="usart__example_8c-source.html#l00068">68</a> of file <a class="el" href="usart__example_8c-source.html">usart_example.c</a>.<p>References <a class="el" href="usart_8h-source.html#l00050">usart_options_t::baudrate</a>, <a class="el" href="usart_8h-source.html#l00077">usart_options_t::channelmode</a>, <a class="el" href="usart_8h-source.html#l00055">usart_options_t::charlength</a>, <a class="el" href="usart_8h-source.html#l00062">usart_options_t::paritytype</a>, <a class="el" href="usart__example_8c-source.html#l00107">pio_enable_module()</a>, <a class="el" href="usart__example_8c-source.html#l00099">print()</a>, <a class="el" href="usart_8h-source.html#l00070">usart_options_t::stopbits</a>, <a class="el" href="usart__example_8c-source.html#l00039">SUCCESS</a>, <a class="el" href="usart_8h-source.html#l00289">USART_1_STOPBIT</a>, <a class="el" href="usart_8c-source.html#l00131">usart_init_rs232()</a>, <a class="el" href="usart_8h-source.html#l00258">USART_NO_PARITY</a>, and <a class="el" href="usart_8h-source.html#l00280">USART_NORMAL_CHMODE</a>.<div class="fragment"><pre class="fragment"><a name="l00069"></a>00069 {<a name="l00070"></a>00070   <span class="keywordtype">int</span> cpu_hz = 20000000;<a name="l00071"></a>00071   <span class="keyword">struct </span><a class="code" href="structusart__options__t.html">usart_options_t</a> opt;<a name="l00072"></a>00072 <a name="l00073"></a>00073   <span class="keyword">volatile</span> <span class="keyword">struct </span>avr32_usart_t *usart = &amp;AVR32_USART1;<a name="l00074"></a>00074 <a name="l00075"></a>00075   <a class="code" href="usart__example_8c.html#a2">avr32_piomap_t</a> usart_piomap = {                                  \<a name="l00076"></a>00076     {AVR32_USART1_RXD_0_PIN, AVR32_USART1_RXD_0_FUNCTION}, \<a name="l00077"></a>00077     {AVR32_USART1_TXD_0_PIN, AVR32_USART1_TXD_0_FUNCTION}   \<a name="l00078"></a>00078   };<a name="l00079"></a>00079 <a name="l00080"></a>00080   <span class="comment">// Set options for the USART</span><a name="l00081"></a>00081   opt.<a class="code" href="structusart__options__t.html#o0">baudrate</a> = 115200;<a name="l00082"></a>00082   opt.<a class="code" href="structusart__options__t.html#o2">charlength</a> = 8;<a name="l00083"></a>00083   opt.<a class="code" href="structusart__options__t.html#o3">paritytype</a> = <a class="code" href="usart_8h.html#a14">USART_NO_PARITY</a>;<a name="l00084"></a>00084   opt.<a class="code" href="structusart__options__t.html#o4">stopbits</a> = <a class="code" href="usart_8h.html#a28">USART_1_STOPBIT</a>;<a name="l00085"></a>00085   opt.<a class="code" href="structusart__options__t.html#o1">channelmode</a> = <a class="code" href="usart_8h.html#a24">USART_NORMAL_CHMODE</a>;<a name="l00086"></a>00086 <a name="l00087"></a>00087   <span class="comment">// Initialize it in RS232 mode</span><a name="l00088"></a>00088   <a class="code" href="usart_8c.html#a3">usart_init_rs232</a>(usart, &amp;opt, cpu_hz);<a name="l00089"></a>00089 <a name="l00090"></a>00090   <span class="comment">// Setup pio for USART</span><a name="l00091"></a>00091   <a class="code" href="usart__example_8c.html#a4">pio_enable_module</a>(usart_piomap, 2);<a name="l00092"></a>00092 <a name="l00093"></a>00093   <a class="code" href="usart__example_8c.html#a3">print</a>(usart, <span class="stringliteral">"This is AVR32 saying hello from the STK1000!\n"</span>);<a name="l00094"></a>00094 <a name="l00095"></a>00095   <span class="keywordflow">return</span> <a class="code" href="usart__example_8c.html#a0">SUCCESS</a>;<a name="l00096"></a>00096 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -