📄 lcd__driver_8c-source.html
字号:
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 }00216 00217 00218 00219 <span class="comment">/*****************************************************************************</span>00220 <span class="comment">*</span>00221 <span class="comment">* Function name : LCD_AllSegments(unsigned char input)</span>00222 <span class="comment">*</span>00223 <span class="comment">* Returns : None</span>00224 <span class="comment">*</span>00225 <span class="comment">* Parameters : show - [TRUE;FALSE]</span>00226 <span class="comment">*</span>00227 <span class="comment">* Purpose : shows or hide all all LCD segments on the LCD</span>00228 <span class="comment">*</span>00229 <span class="comment">*****************************************************************************/</span><a name="l00230"></a><a class="code" href="LCD__driver_8h.html#a20">00230</a> <span class="keywordtype">void</span> <a class="code" href="LCD__driver_8h.html#a20">LCD_AllSegments</a>(<span class="keywordtype">char</span> show)00231 {00232 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> i;00233 00234 <span class="keywordflow">if</span> (show)00235 show = 0xFF;00236 00237 <span class="comment">// Set/clear all bits in all LCD registers</span>00238 <span class="keywordflow">for</span> (i=0; i < <a class="code" href="LCD__driver_8h.html#a3">LCD_REGISTER_COUNT</a>; i++)00239 *(<a class="code" href="LCD__driver_8c.html#a3">LCD_Data</a> + i) = show;00240 }00241 00242 00243 <span class="comment">/*****************************************************************************</span>00244 <span class="comment">*</span>00245 <span class="comment">* LCD Interrupt Routine</span>00246 <span class="comment">*</span>00247 <span class="comment">* Returns : None</span>00248 <span class="comment">*</span>00249 <span class="comment">* Parameters : None</span>00250 <span class="comment">*</span>00251 <span class="comment">* Purpose: Latch the LCD_displayData and Set LCD_status.updateComplete</span>00252 <span class="comment">*</span>00253 <span class="comment">*****************************************************************************/</span>00254 <span class="preprocessor">#pragma vector = LCD_SOF_vect</span><a name="l00255"></a><a class="code" href="LCD__driver_8c.html#a14">00255</a> <span class="preprocessor"></span><a class="code" href="splint_8h.html#a2">__interrupt</a> <span class="keywordtype">void</span> <a class="code" href="LCD__driver_8c.html#a14">LCD_SOF_interrupt</a>(<span class="keywordtype">void</span>)00256 {00257 <span class="keyword">static</span> <span class="keywordtype">char</span> LCD_timer = <a class="code" href="LCD__driver_8h.html#a1">LCD_TIMER_SEED</a>;00258 <span class="keywordtype">char</span> c;00259 <span class="keywordtype">char</span> c_flash;00260 <span class="keywordtype">char</span> flash;00261 00262 <span class="keywordtype">char</span> EOL;00263 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> i;00264 00265 00266 <span class="keyword">static</span> <span class="keywordtype">char</span> timeout_count;00267 00268 00269 <span class="comment">/**************** Button timeout for the button.c, START ****************/</span>00270 <span class="keywordflow">if</span>(!<a class="code" href="button_8c.html#a0">gButtonTimeout</a>)00271 {00272 timeout_count++;00273 00274 <span class="keywordflow">if</span>(timeout_count > 3)00275 {00276 <a class="code" href="button_8c.html#a0">gButtonTimeout</a> = <a class="code" href="LCD__functions_8c.html#a1">TRUE</a>;00277 timeout_count = 0;00278 }00279 }00280 <span class="comment">/**************** Button timeout for the button.c, END ******************/</span>00281 00282 <span class="comment">/**************** Auto press joystick for the main.c, START *************/</span>00283 <span class="comment">/*if(gAutoPressJoystick == AUTO)</span>00284 <span class="comment"> {</span>00285 <span class="comment"> auto_joystick_count++;</span>00286 <span class="comment"></span>00287 <span class="comment"> if(auto_joystick_count > 16)</span>00288 <span class="comment"> {</span>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><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 + -