📄 button_8h.html
字号:
<td> </td> <td><p><p>Definition at line <a class="el" href="button_8h-source.html#l00027">27</a> of file <a class="el" href="button_8h-source.html">button.h</a>.<p>Referenced by <a class="el" href="button_8c-source.html#l00050">Button_Init()</a>, and <a class="el" href="button_8c-source.html#l00092">PinChangeInterrupt()</a>. </td> </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="a8" doxytag="button.h::Button_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 Button_Init </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </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><p>Definition at line <a class="el" href="button_8c-source.html#l00050">50</a> of file <a class="el" href="button_8c-source.html">button.c</a>.<p>References <a class="el" href="main_8h-source.html#l00026">cbi</a>, <a class="el" href="button_8h-source.html#l00026">PINB_MASK</a>, and <a class="el" href="button_8h-source.html#l00027">PINE_MASK</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00206">Initialization()</a>.<p><pre class="fragment"><div>00051 {00052 <span class="comment">// Init port pins</span>00053 <a class="code" href="main_8h.html#a1">cbi</a>(DDRB,7);00054 <a class="code" href="main_8h.html#a1">cbi</a>(DDRB,6);00055 <a class="code" href="main_8h.html#a1">cbi</a>(DDRB,4);00056 PORTB |= <a class="code" href="button_8h.html#a0">PINB_MASK</a>;00057 DDRE = 0x00;00058 PORTE |= <a class="code" href="button_8h.html#a1">PINE_MASK</a>;00059 00060 <span class="comment">// Enable pin change interrupt on PORTB and PORTE</span>00061 PCMSK0 = <a class="code" href="button_8h.html#a1">PINE_MASK</a>;00062 PCMSK1 = <a class="code" href="button_8h.html#a0">PINB_MASK</a>;00063 EIFR = (1<<PCIF0)|(1<<PCIF1);00064 EIMSK = (1<<PCIE0)|(1<<PCIE1);00065 }</div></pre> </td> </tr></table><a class="anchor" name="a10" doxytag="button.h::ButtonBouncing" ></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 ButtonBouncing </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </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> </td> </tr></table><a class="anchor" name="a9" doxytag="button.h::getkey" ></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 getkey </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </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><p>Definition at line <a class="el" href="button_8c-source.html#l00161">161</a> of file <a class="el" href="button_8c-source.html">button.c</a>.<p>References <a class="el" href="LCD__functions_8c-source.html#l00030">FALSE</a>, <a class="el" href="button_8c-source.html#l00034">KEY</a>, <a class="el" href="main_8h.html#a27a17">KEY_NULL</a>, and <a class="el" href="button_8c-source.html#l00035">KEY_VALID</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00084">main()</a>.<p><pre class="fragment"><div>00162 {00163 <span class="keywordtype">char</span> k;00164 00165 __disable_interrupt();00166 00167 <span class="keywordflow">if</span> (<a class="code" href="button_8c.html#a2">KEY_VALID</a>) <span class="comment">// Check for unread key in buffer</span>00168 {00169 k = <a class="code" href="button_8c.html#a1">KEY</a>;00170 <a class="code" href="button_8c.html#a2">KEY_VALID</a> = <a class="code" href="LCD__functions_8c.html#a0">FALSE</a>;00171 }00172 <span class="keywordflow">else</span>00173 k = <a class="code" href="main_8h.html#a27a17">KEY_NULL</a>; <span class="comment">// No key stroke available</span>00174 00175 __enable_interrupt();00176 00177 <span class="keywordflow">return</span> k;00178 }</div></pre> </td> </tr></table><a class="anchor" name="a7" doxytag="button.h::PinChangeInterrupt" ></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 PinChangeInterrupt </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </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><p>Definition at line <a class="el" href="button_8c-source.html#l00092">92</a> of file <a class="el" href="button_8c-source.html">button.c</a>.<p>References <a class="el" href="button_8h-source.html#l00029">BUTTON_A</a>, <a class="el" href="button_8h-source.html#l00030">BUTTON_B</a>, <a class="el" href="button_8h-source.html#l00031">BUTTON_C</a>, <a class="el" href="button_8h-source.html#l00032">BUTTON_D</a>, <a class="el" href="button_8h-source.html#l00033">BUTTON_O</a>, <a class="el" href="LCD__functions_8c-source.html#l00030">FALSE</a>, <a class="el" href="button_8c-source.html#l00032">gButtonTimeout</a>, <a class="el" href="button_8c-source.html#l00034">KEY</a>, <a class="el" href="main_8h.html#a27a18">KEY_ENTER</a>, <a class="el" href="main_8h.html#a27a22">KEY_MINUS</a>, <a class="el" href="main_8h.html#a27a19">KEY_NEXT</a>, <a class="el" href="main_8h.html#a27a17">KEY_NULL</a>, <a class="el" href="main_8h.html#a27a21">KEY_PLUS</a>, <a class="el" href="main_8h.html#a27a20">KEY_PREV</a>, <a class="el" href="button_8c-source.html#l00035">KEY_VALID</a>, <a class="el" href="button_8h-source.html#l00026">PINB_MASK</a>, <a class="el" href="button_8h-source.html#l00027">PINE_MASK</a>, and <a class="el" href="LCD__functions_8c-source.html#l00031">TRUE</a>.<p>Referenced by <a class="el" href="button_8c-source.html#l00069">PCINT0_interrupt()</a>, and <a class="el" href="button_8c-source.html#l00075">PCINT1_interrupt()</a>.<p><pre class="fragment"><div>00093 {00094 <span class="keywordtype">char</span> buttons;00095 00096 <span class="keywordtype">char</span> key;00097 00098 <span class="comment">/*</span>00099 <span class="comment"> Read the buttons:</span>00100 <span class="comment"></span>00101 <span class="comment"> Bit 7 6 5 4 3 2 1 0</span>00102 <span class="comment"> ---------------------------------------------</span>00103 <span class="comment"> PORTB B A O</span>00104 <span class="comment"> PORTE D C</span>00105 <span class="comment"> ---------------------------------------------</span>00106 <span class="comment"> PORTB | PORTE B A O D C</span>00107 <span class="comment"> =============================================</span>00108 <span class="comment">*/</span>00109 00110 00111 buttons = (~PINB) & <a class="code" href="button_8h.html#a0">PINB_MASK</a>;00112 buttons |= (~PINE) & <a class="code" href="button_8h.html#a1">PINE_MASK</a>;00113 00114 <span class="comment">// Output virtual keys</span>00115 <span class="keywordflow">if</span> (buttons & (1<<<a class="code" href="button_8h.html#a2">BUTTON_A</a>))00116 key = <a class="code" href="main_8h.html#a27a21">KEY_PLUS</a>;00117 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (buttons & (1<<<a class="code" href="button_8h.html#a3">BUTTON_B</a>))00118 key = <a class="code" href="main_8h.html#a27a22">KEY_MINUS</a>;00119 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (buttons & (1<<<a class="code" href="button_8h.html#a4">BUTTON_C</a>))00120 key = <a class="code" href="main_8h.html#a27a20">KEY_PREV</a>;00121 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (buttons & (1<<<a class="code" href="button_8h.html#a5">BUTTON_D</a>))00122 key = <a class="code" href="main_8h.html#a27a19">KEY_NEXT</a>;00123 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (buttons & (1<<<a class="code" href="button_8h.html#a6">BUTTON_O</a>))00124 key = <a class="code" href="main_8h.html#a27a18">KEY_ENTER</a>;00125 <span class="keywordflow">else</span>00126 key = <a class="code" href="main_8h.html#a27a17">KEY_NULL</a>;00127 00128 00129 <span class="keywordflow">if</span>(key != <a class="code" href="main_8h.html#a27a17">KEY_NULL</a>)00130 {00131 <span class="keywordflow">if</span>(<a class="code" href="button_8c.html#a0">gButtonTimeout</a>) <span class="comment">// gButtonTimeout is set in the LCD_SOF_interrupt in LCD_driver.c</span>00132 {00133 <span class="keywordflow">if</span> (!<a class="code" href="button_8c.html#a2">KEY_VALID</a>)00134 {00135 <a class="code" href="button_8c.html#a1">KEY</a> = key; <span class="comment">// Store key in global key buffer</span>00136 <a class="code" href="button_8c.html#a2">KEY_VALID</a> = <a class="code" href="LCD__functions_8c.html#a1">TRUE</a>;00137 }00138 00139 <a class="code" href="button_8c.html#a0">gButtonTimeout</a> = <a class="code" href="LCD__functions_8c.html#a0">FALSE</a>;00140 00141 }00142 }00143 00144 EIFR = (1<<PCIF1) | (1<<PCIF0); <span class="comment">// Delete pin change interrupt flags</span>00145 00146 00147 }</div></pre> </td> </tr></table><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 + -