📄 lcd__driver_8c.html
字号:
00289 <span class="comment"> gAutoPressJoystick = TRUE;</span>00290 <span class="comment"> auto_joystick_count = 15;</span>00291 <span class="comment"> }</span>00292 <span class="comment"> }</span>00293 <span class="comment"> else</span>00294 <span class="comment"> auto_joystick_count = 0;</span>00295 <span class="comment"> */</span>00296 <span class="comment">/**************** Auto press joystick for the main.c, END ***************/</span>00297 00298 LCD_timer--; <span class="comment">// Decreased every LCD frame</span>00299 00300 <span class="keywordflow">if</span> (<a class="code" href="LCD__driver_8c.html#a6">gScrollMode</a>)00301 {00302 <span class="comment">// If we are in scroll mode, and the timer has expired,</span>00303 <span class="comment">// we will update the LCD</span>00304 <span class="keywordflow">if</span> (LCD_timer == 0)00305 {00306 <span class="keywordflow">if</span> (<a class="code" href="LCD__driver_8c.html#a7">gLCD_Start_Scroll_Timer</a> == 0)00307 {00308 <a class="code" href="LCD__driver_8c.html#a2">gLCD_Update_Required</a> = <a class="code" href="LCD__functions_8c.html#a1">TRUE</a>;00309 }00310 <span class="keywordflow">else</span>00311 <a class="code" href="LCD__driver_8c.html#a7">gLCD_Start_Scroll_Timer</a>--;00312 }00313 }00314 <span class="keywordflow">else</span>00315 { <span class="comment">// if not scrolling,</span>00316 <span class="comment">// disble LCD start of frame interrupt</span>00317 <span class="comment">// cbi(LCDCRA, LCDIE); //DEBUG</span>00318 <a class="code" href="LCD__driver_8c.html#a5">gScroll</a> = 0;00319 }00320 00321 00322 EOL = <a class="code" href="LCD__functions_8c.html#a0">FALSE</a>;00323 <span class="keywordflow">if</span> (<a class="code" href="LCD__driver_8c.html#a2">gLCD_Update_Required</a> == <a class="code" href="LCD__functions_8c.html#a1">TRUE</a>)00324 {00325 <span class="comment">// Duty cycle of flashing characters</span>00326 <span class="keywordflow">if</span> (gFlashTimer < (LCD_FLASH_SEED >> 1))00327 flash = 0;00328 <span class="keywordflow">else</span>00329 flash = 1;00330 00331 <span class="comment">// Repeat for the six LCD characters</span>00332 <span class="keywordflow">for</span> (i = 0; i < 6; i++)00333 {00334 <span class="keywordflow">if</span> ((<a class="code" href="LCD__driver_8c.html#a5">gScroll</a>+i) >= 0 && (!EOL))00335 {00336 <span class="comment">// We have some visible characters</span>00337 c = <a class="code" href="LCD__driver_8c.html#a4">gTextBuffer</a>[i + <a class="code" href="LCD__driver_8c.html#a5">gScroll</a>];00338 c_flash = c & 0x80 ? 1 : 0;00339 c = c & 0x7F;00340 00341 <span class="keywordflow">if</span> (c == <span class="charliteral">'\0'</span>)00342 EOL = i+1; <span class="comment">// End of character data</span>00343 }00344 <span class="keywordflow">else</span>00345 c = <span class="charliteral">' '</span>;00346 00347 <span class="comment">// Check if this character is flashing</span>00348 00349 <span class="keywordflow">if</span> (c_flash && flash)00350 <a class="code" href="LCD__driver_8h.html#a19">LCD_WriteDigit</a>(<span class="charliteral">' '</span>, i);00351 <span class="keywordflow">else</span>00352 <a class="code" href="LCD__driver_8h.html#a19">LCD_WriteDigit</a>(c, i);00353 }00354 00355 <span class="comment">// Copy the segment buffer to the real segments</span>00356 <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="LCD__driver_8h.html#a3">LCD_REGISTER_COUNT</a>; i++)00357 *(<a class="code" href="LCD__driver_8h.html#a9">pLCDREG</a> + i) = *(<a class="code" href="LCD__driver_8c.html#a3">LCD_Data</a>+i);00358 00359 <span class="comment">// Handle colon</span>00360 <span class="keywordflow">if</span> (<a class="code" href="LCD__driver_8c.html#a9">gColon</a>)00361 *(<a class="code" href="LCD__driver_8h.html#a9">pLCDREG</a> + 8) = 0x01;00362 <span class="keywordflow">else</span>00363 *(<a class="code" href="LCD__driver_8h.html#a9">pLCDREG</a> + 8) = 0x00;00364 00365 <span class="comment">// If the text scrolled off the display,</span>00366 <span class="comment">// we have to start over again.</span>00367 <span class="keywordflow">if</span> (EOL == 1)00368 <a class="code" href="LCD__driver_8c.html#a5">gScroll</a> = -6;00369 <span class="keywordflow">else</span>00370 <a class="code" href="LCD__driver_8c.html#a5">gScroll</a>++;00371 00372 <span class="comment">// No need to update anymore</span>00373 <a class="code" href="LCD__driver_8c.html#a2">gLCD_Update_Required</a> = <a class="code" href="LCD__functions_8c.html#a0">FALSE</a>;00374 }00375 00376 00377 <span class="comment">// LCD_timer is used when scrolling text</span>00378 <span class="keywordflow">if</span> (LCD_timer == 0)00379 {00380 <span class="comment">/* if ((gScroll <= 0) || EOL)</span>00381 <span class="comment"> LCD_timer = LCD_TIMER_SEED/2;</span>00382 <span class="comment"> else*/</span>00383 LCD_timer = <a class="code" href="LCD__driver_8h.html#a1">LCD_TIMER_SEED</a>;00384 }00385 00386 <span class="comment">// gFlashTimer is used when flashing characters</span>00387 <span class="keywordflow">if</span> (<a class="code" href="LCD__driver_8c.html#a8">gFlashTimer</a> == <a class="code" href="LCD__driver_8h.html#a2">LCD_FLASH_SEED</a>)00388 <a class="code" href="LCD__driver_8c.html#a8">gFlashTimer</a>= 0;00389 <span class="keywordflow">else</span>00390 <a class="code" href="LCD__driver_8c.html#a8">gFlashTimer</a>++;00391 00392 }</div></pre><p>Here is the call graph for this function:<p><center><img src="LCD__driver_8c_a14_cgraph.png" border="0" usemap="#LCD__driver_8c_a14_cgraph_map" alt=""></center><map name="LCD__driver_8c_a14_cgraph_map"><area href="LCD__driver_8h.html#a19" shape="rect" coords="196,7,311,33" alt=""></map> </td> </tr></table><a class="anchor" name="a12" doxytag="LCD_driver.c::LCD_WriteDigit" ></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 LCD_WriteDigit </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char </td> <td class="mdname" nowrap> <em>c</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>char </td> <td class="mdname" nowrap> <em>digit</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></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="LCD__driver_8c-source.html#l00174">174</a> of file <a class="el" href="LCD__driver_8c-source.html">LCD_driver.c</a>.<p>References <a class="el" href="LCD__driver_8c-source.html#l00063">LCD_character_table</a>, <a class="el" href="LCD__driver_8c-source.html#l00038">LCD_Data</a>, and <a class="el" href="AVRGSM__zip_8c-source.html#l00027">mask</a>.<p>Referenced by <a class="el" href="LCD__driver_8c-source.html#l00255">LCD_SOF_interrupt()</a>.<p><pre class="fragment"><div>00175 {00176 00177 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> seg = 0x0000; <span class="comment">// Holds the segment pattern</span>00178 <span class="keywordtype">char</span> <a class="code" href="AVRGSM__zip_8c.html#a1">mask</a>, nibble;00179 <span class="keywordtype">char</span> *ptr;00180 <span class="keywordtype">char</span> i;00181 00182 00183 <span class="keywordflow">if</span> (digit > 5) <span class="comment">// Skip if digit is illegal</span>00184 <span class="keywordflow">return</span>;00185 00186 <span class="comment">//Lookup character table for segmet data</span>00187 <span class="keywordflow">if</span> ((c >= <span class="charliteral">'*'</span>) && (c <= <span class="charliteral">'z'</span>))00188 {00189 <span class="comment">// c is a letter</span>00190 <span class="keywordflow">if</span> (c >= <span class="charliteral">'a'</span>) <span class="comment">// Convert to upper case</span>00191 c &= ~0x20; <span class="comment">// if necessarry</span>00192 00193 c -= <span class="charliteral">'*'</span>;00194 00195 seg = <a class="code" href="LCD__driver_8c.html#a10">LCD_character_table</a>[c];00196 }00197 00198 <span class="comment">// Adjust mask according to LCD segment mapping</span>00199 <span class="keywordflow">if</span> (digit & 0x01)00200 <a class="code" href="AVRGSM__zip_8c.html#a1">mask</a> = 0x0F; <span class="comment">// Digit 1, 3, 5</span>00201 <span class="keywordflow">else</span>00202 <a class="code" href="AVRGSM__zip_8c.html#a1">mask</a> = 0xF0; <span class="comment">// Digit 0, 2, 4</span>00203 00204 ptr = <a class="code" href="LCD__driver_8c.html#a3">LCD_Data</a> + (digit >> 1); <span class="comment">// digit = {0,0,1,1,2,2}</span>00205 00206 <span class="keywordflow">for</span> (i = 0; i < 4; i++)00207 {00208 nibble = seg & 0x000F;00209 seg >>= 4;00210 <span class="keywordflow">if</span> (digit & 0x01)00211 nibble <<= 4;00212 *ptr = (*ptr & <a class="code" href="AVRGSM__zip_8c.html#a1">mask</a>) | nibble;00213 ptr += 5;00214 }00215 }</div></pre> </td> </tr></table><hr><h2>Variable Documentation</h2><a class="anchor" name="a1" doxytag="LCD_driver.c::gAutoPressJoystick" ></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"> BOOL <a class="el" href="LCD__driver_8c.html#a1">gAutoPressJoystick</a> </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="LCD__driver_8c-source.html#l00032">32</a> of file <a class="el" href="LCD__driver_8c-source.html">LCD_driver.c</a>. </td> </tr></table><a class="anchor" name="a0" doxytag="LCD_driver.c::gButtonTimeout" ></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"> unsigned char <a class="el" href="LCD__driver_8c.html#a0">gButtonTimeout</a> </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="LCD__driver_8c-source.html#l00030">30</a> of file <a class="el" href="LCD__driver_8c-source.html">LCD_driver.c</a>.<p>Referenced by <a class="el" href="LCD__driver_8c-source.html#l00255">LCD_SOF_interrupt()</a>, and <a class="el" href="button_8c-source.html#l00092">PinChangeInterrupt()</a>. </td> </tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -