📄 pio__example2__dip__switch__lights_8c.html
字号:
<p><p>Definition at line <a class="el" href="pio__example2__dip__switch__lights_8c-source.html#l00017">17</a> of file <a class="el" href="pio__example2__dip__switch__lights_8c-source.html">pio_example2_dip_switch_lights.c</a>.</div></div><p><a class="anchor" name="e8ddaa2baea40a4338f7009dfb562920"></a><!-- doxytag: member="pio_example2_dip_switch_lights.c::purple" ref="e8ddaa2baea40a4338f7009dfb562920" args="" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">#define purple 0x11 </td> </tr> </table></div><div class="memdoc"><p><p>Definition at line <a class="el" href="pio__example2__dip__switch__lights_8c-source.html#l00010">10</a> of file <a class="el" href="pio__example2__dip__switch__lights_8c-source.html">pio_example2_dip_switch_lights.c</a>.</div></div><p><a class="anchor" name="b435487e41a1d42d4379464e35f873b4"></a><!-- doxytag: member="pio_example2_dip_switch_lights.c::red" ref="b435487e41a1d42d4379464e35f873b4" args="" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">#define red 0x01 </td> </tr> </table></div><div class="memdoc"><p><p>Definition at line <a class="el" href="pio__example2__dip__switch__lights_8c-source.html#l00006">6</a> of file <a class="el" href="pio__example2__dip__switch__lights_8c-source.html">pio_example2_dip_switch_lights.c</a>.</div></div><p><a class="anchor" name="85bd03e30e523319b5e069e7a8a0f81d"></a><!-- doxytag: member="pio_example2_dip_switch_lights.c::white" ref="85bd03e30e523319b5e069e7a8a0f81d" args="" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">#define white 0x15 </td> </tr> </table></div><div class="memdoc"><p><p>Definition at line <a class="el" href="pio__example2__dip__switch__lights_8c-source.html#l00012">12</a> of file <a class="el" href="pio__example2__dip__switch__lights_8c-source.html">pio_example2_dip_switch_lights.c</a>.</div></div><p><a class="anchor" name="aa509be08a5019c968f558d628a2a540"></a><!-- doxytag: member="pio_example2_dip_switch_lights.c::yellow" ref="aa509be08a5019c968f558d628a2a540" args="" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">#define yellow 0x05 </td> </tr> </table></div><div class="memdoc"><p><p>Definition at line <a class="el" href="pio__example2__dip__switch__lights_8c-source.html#l00008">8</a> of file <a class="el" href="pio__example2__dip__switch__lights_8c-source.html">pio_example2_dip_switch_lights.c</a>.</div></div><p><hr><h2>Function Documentation</h2><a class="anchor" name="840291bc02cba5474a4cb46a9b9566fe"></a><!-- doxytag: member="pio_example2_dip_switch_lights.c::main" ref="840291bc02cba5474a4cb46a9b9566fe" args="(void)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">int main </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>This function will read the dip switches on the STK1000 and put the status out on the leds. To get it to work, you must connect the input and output correctly on the STK1000. The input (switches) header marked J25 must be connected to the header labeled J2 (PORTB[15..8]). While the output (leds) header marked J15 must be connected to the header marked J1 (PORTB[7..]) <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>none</em> </td><td></td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>none </dd></dl><p>Definition at line <a class="el" href="pio__example2__dip__switch__lights_8c-source.html#l00028">28</a> of file <a class="el" href="pio__example2__dip__switch__lights_8c-source.html">pio_example2_dip_switch_lights.c</a>.<p>References <a class="el" href="advanced__dip__switch__lights_8c-source.html#l00017">INPUT_BITMASK</a>, <a class="el" href="advanced__dip__switch__lights_8c-source.html#l00018">OUTPUT_BITMASK</a>, and <a class="el" href="pdc__example_8c-source.html#l00050">piob</a>.<div class="fragment"><pre class="fragment"><a name="l00029"></a>00029 {<a name="l00030"></a>00030 avr32_pio_t *<a class="code" href="pdc__example_8c.html#305f96d612af5d9d17a8dd222dd01908">piob</a> = (<span class="keywordtype">void</span> *) AVR32_PIOB;<a name="l00031"></a>00031 <span class="keywordtype">char</span> input, output;<a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="comment">/* SET PIO */</span><a name="l00034"></a>00034 piob->pdr = 0x00000000; <span class="comment">/* Enable entire PORTB for PIO controlled operation */</span><a name="l00035"></a>00035 piob->oer = <a class="code" href="advanced__dip__switch__lights_8c.html#7c6076112d202a6144c09269619275f7">OUTPUT_BITMASK</a>; <span class="comment">/* Use PORTB[15..8] as output */</span><a name="l00036"></a>00036 piob->odr = <a class="code" href="advanced__dip__switch__lights_8c.html#7f2143a2b202b189256b745ddca82824">INPUT_BITMASK</a>; <span class="comment">/* Use PORTB[7..0] as input */</span><a name="l00037"></a>00037 piob->ifer = <a class="code" href="advanced__dip__switch__lights_8c.html#7f2143a2b202b189256b745ddca82824">INPUT_BITMASK</a>; <span class="comment">/*Glitch enable on input */</span><a name="l00038"></a>00038 piob->codr = 0xFFFFffff; <span class="comment">/* Clear all appropriate pins */</span><a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="keywordflow">while</span>(1){<a name="l00041"></a>00041 <span class="comment">/* read input and output */</span><a name="l00042"></a>00042 input = (~(piob->pdsr >> 8) & <a class="code" href="advanced__dip__switch__lights_8c.html#7c6076112d202a6144c09269619275f7">OUTPUT_BITMASK</a>);<a name="l00043"></a>00043 output = (piob->pdsr) & <a class="code" href="advanced__dip__switch__lights_8c.html#7c6076112d202a6144c09269619275f7">OUTPUT_BITMASK</a>;<a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="comment">/* check if a change has occured */</span><a name="l00046"></a>00046 <span class="keywordflow">if</span>( input != output){<a name="l00047"></a>00047 <span class="comment">/* Clear the output data */</span><a name="l00048"></a>00048 piob->codr = <a class="code" href="advanced__dip__switch__lights_8c.html#7c6076112d202a6144c09269619275f7">OUTPUT_BITMASK</a>;<a name="l00049"></a>00049 <span class="comment">/* Set output data according to the input */</span><a name="l00050"></a>00050 piob->sodr = input;<a name="l00051"></a>00051 } <span class="comment">//if</span><a name="l00052"></a>00052 }<span class="comment">//while</span><a name="l00053"></a>00053 }<span class="comment">//main</span></pre></div><p></div></div><p><hr><h2>Variable Documentation</h2><a class="anchor" name="1cb9c8afac0f446a3910f0763440bfde"></a><!-- doxytag: member="pio_example2_dip_switch_lights.c::color_array" ref="1cb9c8afac0f446a3910f0763440bfde" args="[8]" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">char <a class="el" href="pio__example2__dip__switch__lights_8c.html#1cb9c8afac0f446a3910f0763440bfde">color_array</a>[8] = {black,purple,blue,light_blue,green,yellow,red,white} </td> </tr> </table></div><div class="memdoc"><p><p>Definition at line <a class="el" href="pio__example2__dip__switch__lights_8c-source.html#l00014">14</a> of file <a class="el" href="pio__example2__dip__switch__lights_8c-source.html">pio_example2_dip_switch_lights.c</a>.</div></div><p><hr size="1"><address style="align: right;"><small>Generated on Thu May 10 14:14:48 2007 for AVR321000 Communication with the AVR32 USART by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -