?? vs10xx_8h.html
字號:
</tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>VS10xx SCI Write Command byte is 0x02. <p><p>Definition at line <a class="el" href="vs10xx_8h-source.html#l00013">13</a> of file <a class="el" href="vs10xx_8h-source.html">vs10xx.h</a>. </td> </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="a41" doxytag="vs10xx.h::AvailableProcessorTime" ></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 AvailableProcessorTime </td> <td class="md" valign="top">( </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>This is called when there is free processor time, implement externally. <p>The basic task of this function is to implement the player user interface. <p>Local variables:<p><ul><li><b>volume</b>: Current volume setting</li></ul><p><ul><li><b>bass</b>: Current bass enhancer setting</li></ul><p><ul><li><b>treble</b>: Current treble enhancer setting</li></ul><p><ul><li><b>reclevel</b>: Current recording level setting</li></ul><p><ul><li><b>uiReturnDelay</b>: Counts down to returning to UI mode 0 (title screen)</li></ul><p>Bass/Treble setting calculation<p>There are 2 or 4 adjustments possible:<ul><li>Bass Frequency (1011B/E, 1002, 10x3) : 2..15 -> 20..1500 Hz</li><li>Bass boost (1011B/E, 1002, 10x3) : 0..15 -> 0ff..+15dB)</li><li>Treble Frequency (1011E, 10x3) : 0..15 -> 0..15kHz</li><li>Treble level (1011E, 10x3) : -8..+7 -> -12..+10.5dB</li></ul><p>In this software, all are adjusted based from a single setting (0..128) for bass and another for treble. You may wish to allow user to control frequency and level separately or set fixed frequencies for a known speaker type. This algorithm increases the frequency range of adjustment with the increasing level. <p>Definition at line <a class="el" href="player_8c-source.html#l00332">332</a> of file <a class="el" href="player_8c-source.html">player.c</a>.<p>References <a class="el" href="display_8c-source.html#l00014">displayStyle</a>, <a class="el" href="display_8c-source.html#l00011">displayTitle</a>, <a class="el" href="display_8c-source.html#l00015">displayValue</a>, <a class="el" href="display_8h-source.html#l00012">DS_NO_YES</a>, <a class="el" href="display_8h-source.html#l00011">DS_PERCENTAGE</a>, <a class="el" href="display_8h-source.html#l00014">DS_RAWTEXT</a>, <a class="el" href="display_8h-source.html#l00009">DS_TEXT</a>, <a class="el" href="board_8h-source.html#l00095">KEY_BUTTON</a>, <a class="el" href="board_8h-source.html#l00110">KEY_FARLEFT</a>, <a class="el" href="board_8h-source.html#l00098">KEY_FARRIGHT</a>, <a class="el" href="lcdfonts_8c-source.html#l00008">lcdFont_barchars</a>, <a class="el" href="lcdfonts_8c-source.html#l00025">lcdFont_vertical_barchars</a>, <a class="el" href="lcd_8c-source.html#l00056">LcdReset()</a>, <a class="el" href="lcd_8c-source.html#l00043">LcdSelectFont()</a>, <a class="el" href="vs10xx_8c-source.html#l00017">Mp3ReadRegister()</a>, <a class="el" href="vs10xx_8h-source.html#l00078">Mp3SetVolume</a>, <a class="el" href="vs10xx_8h-source.html#l00068">Mp3WriteRegister</a>, <a class="el" href="player_8c-source.html#l00226">playingState</a>, <a class="el" href="ui_8h.html#a25a16">PS_CUE</a>, <a class="el" href="ui_8h.html#a25a13">PS_END_OF_SONG</a>, <a class="el" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>, <a class="el" href="ui_8h.html#a25a12">PS_NORMAL</a>, <a class="el" href="ui_8h.html#a25a15">PS_PREVIOUS_SONG</a>, <a class="el" href="ui_8h.html#a25a23">PS_RECORDING</a>, <a class="el" href="ui_8h.html#a25a19">PS_REWIND</a>, <a class="el" href="player_8c-source.html#l00290">ScreenSetPlayTime()</a>, <a class="el" href="vs10xx_8h-source.html#l00032">SPI_AICTRL1</a>, <a class="el" href="vs10xx_8h-source.html#l00021">SPI_BASS</a>, <a class="el" href="board_8h-source.html#l00235">SPIPutChar</a>, <a class="el" href="board_8h-source.html#l00232">SPIWait</a>, <a class="el" href="ui_8h.html#a24a5">UI_BASS</a>, <a class="el" href="ui_8h.html#a24a7">UI_CUE</a>, <a class="el" href="ui_8h.html#a24a11">UI_END_OF_MODES</a>, <a class="el" href="ui_8h.html#a24a9">UI_INFO</a>, <a class="el" href="ui_8h.html#a24a8">UI_RECLEVEL</a>, <a class="el" href="player_8c-source.html#l00223">UI_RETURN_DELAY</a>, <a class="el" href="ui_8h.html#a24a3">UI_SPEC</a>, <a class="el" href="ui_8h.html#a24a10">UI_STOP</a>, <a class="el" href="ui_8h.html#a24a2">UI_TITLE</a>, <a class="el" href="ui_8h.html#a24a6">UI_TREBLE</a>, <a class="el" href="ui_8h.html#a24a4">UI_VOLUME</a>, <a class="el" href="player_8c-source.html#l00236">uiMode</a>, <a class="el" href="display_8c-source.html#l00058">UpdateDisplay()</a>, and <a class="el" href="player_8c-source.html#l00233">userInterfaceDelayElapsed</a>.<p>Referenced by <a class="el" href="aviplay_8c-source.html#l00015">GetAVIBlock()</a>, <a class="el" href="vs10xx_8c-source.html#l00202">PlayDiskSectors()</a>, and <a class="el" href="record_8c-source.html#l00101">Record()</a>.<p><pre class="fragment"><div>00332 {00333 00337 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> volume = 20;00338 00340 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> bass = 0;00341 00343 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> treble = 64; <span class="comment">//middle setting = 0</span>00344 00346 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> reclevel = 50;00347 00348 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i; <span class="comment">//temp variable</span>00349 00350 <span class="keyword">static</span> bit bassUpdateNeeded;00351 00355 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> uiReturnDelay=0;00356 00357 00358 <span class="preprocessor">#if 0</span>00359 <span class="preprocessor"></span> <span class="comment">// Simple serial control demo: receiving 'N' advances to next song</span>00360 <span class="comment">// and 'P' to previous song</span>00361 00362 <span class="keywordflow">if</span> (RI) { <span class="comment">//Serial Data Received</span>00363 RI = 0; <span class="comment">//Clear received flag!!!</span>00364 00365 i = SBUF; <span class="comment">// read received character from uart buffer to temp i</span>00366 00367 <span class="keywordflow">if</span> (i==<span class="charliteral">'N'</span>){00368 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>;00369 }00370 <span class="keywordflow">if</span> (i==<span class="charliteral">'P'</span>){00371 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a15">PS_PREVIOUS_SONG</a>;00372 }00373 }00374 <span class="preprocessor">#endif</span>00375 <span class="preprocessor"></span>00376 00377 00378 00379 <span class="keywordflow">if</span> (!<a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a>){00380 <span class="keywordflow">return</span>; <span class="comment">/* Not yet time to do user interface stuff */</span>00381 }00382 00383 <a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a> = 0;00384 00385 00386 <span class="comment">// User Interface Modes</span>00387 <span class="comment">// Return to UI_TITLE after long period of button inactivity</span>00388 00389 <span class="keywordflow">if</span> (uiReturnDelay == 0){00390 <span class="keywordflow">if</span> ((<a class="code" href="player_8c.html#a6">uiMode</a> != <a class="code" href="ui_8h.html#a24a3">UI_SPEC</a>)&&(<a class="code" href="player_8c.html#a6">uiMode</a> != <a class="code" href="ui_8h.html#a24a7">UI_CUE</a>))00391 <a class="code" href="player_8c.html#a6">uiMode</a> = <a class="code" href="ui_8h.html#a24a2">UI_TITLE</a>;00392 <span class="keywordflow">else</span>{00393 }00394 }<span class="keywordflow">else</span>{00395 uiReturnDelay--;00396 }00397 00398 00399 00400 <span class="preprocessor">#ifndef VS1003</span>00401 <span class="preprocessor"></span> <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a6">uiMode</a>==<a class="code" href="ui_8h.html#a24a3">UI_SPEC</a>) <span class="comment">//Only VS1003 has spectrum analyzer</span>00402 <a class="code" href="player_8c.html#a6">uiMode</a>++;00403 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a6">uiMode</a>==<a class="code" href="ui_8h.html#a24a8">UI_RECLEVEL</a>) <span class="comment">//Only record in VS1003 chips</span>00404 <a class="code" href="player_8c.html#a6">uiMode</a>++;00405 <span class="preprocessor">#endif</span>00406 <span class="preprocessor"></span>00407 00408 00409 00410 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a6">uiMode</a>==<a class="code" href="ui_8h.html#a24a9">UI_INFO</a>)00411 <a class="code" href="player_8c.html#a6">uiMode</a>++; <span class="comment">//Nothing interesting currently in screen UI_INFO.</span>00412 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a6">uiMode</a>==<a class="code" href="ui_8h.html#a24a10">UI_STOP</a>)00413 <a class="code" href="player_8c.html#a6">uiMode</a>++; <span class="comment">//Nothing interesting currently in screen UI_STOP.</span>00414 00415 <span class="comment">/* Screen updates */</span>00416 <span class="keywordflow">switch</span>(<a class="code" href="player_8c.html#a6">uiMode</a>){00417 00418 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a2">UI_TITLE</a>: <span class="comment">//Playing time, song title</span>00419 00420 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a1">DS_TEXT</a>;00421 <a class="code" href="player_8c.html#a11">ScreenSetPlayTime</a>();00422 00423 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a>==<a class="code" href="ui_8h.html#a25a23">PS_RECORDING</a>){ 00424 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00425 } 00426 00427 <span class="keywordflow">break</span>;00428 00429 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a10">UI_STOP</a>: <span class="comment">//Ask if the user wants to stop</span>00430 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a4">DS_NO_YES</a>;00431 strcpy (displayTitle, <span class="stringliteral">"Stop? "</span>);00432 <span class="keywordflow">break</span>;00433 00434 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a7">UI_CUE</a>: <span class="comment">//Ask if the user wants to fast forward or rewind</span>00435 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a6">DS_RAWTEXT</a>;00436 strcpy (displayTitle, <span class="stringliteral">"REW/CUE <- ->"</span>);00437 00438 <span class="comment">//i = Mp3ReadRegister(SPI_HDAT1);</span>00439 <span class="comment">//displayTitle[5] = lcd_hexchars[i>>12];</span>00440 <span class="comment">//displayTitle[6] = lcd_hexchars[(i>>8)&0x0f];</span>00441 <span class="comment">//displayTitle[7] = lcd_hexchars[(i>>4)&0x0f];</span>00442 <span class="comment">//displayTitle[8] = lcd_hexchars[i&0x0f];</span>00443 00444 <span class="keywordflow">break</span>;00445 00446 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a4">UI_VOLUME</a>: <span class="comment">//Show volume bar</span>00447 <a class="code" href="lcd_8h.html#a5">LcdSelectFont</a>(lcdFont_barchars);00448 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00449 strcpy(displayTitle,<span class="stringliteral">"Volume: "</span>);00450 <a class="code" href="display_8c.html#a5">displayValue</a> = (100-(volume>>1));00451 <span class="keywordflow">if</span> (<a class="code" href="display_8c.html#a5">displayValue</a><0) <a class="code" href="display_8c.html#a5">displayValue</a> = 0;00452 <span class="keywordflow">break</span>;00453 00454 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a5">UI_BASS</a>: <span class="comment">//Show bass bar</span>00455 <a class="code" href="lcd_8h.html#a5">LcdSelectFont</a>(lcdFont_barchars);00456 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00457 strcpy(displayTitle,<span class="stringliteral">"Bass: "</span>);00458 <a class="code" href="display_8c.html#a5">displayValue</a> = (bass/5)*4;00459 <span class="keywordflow">if</span> (<a class="code" href="display_8c.html#a5">displayValue</a><1) <a class="code" href="display_8c.html#a5">displayValue</a> = 1;00460 <span class="keywordflow">break</span>;00461 00462 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a6">UI_TREBLE</a>: <span class="comment">//Show treble bar</span>00463 <a class="code" href="lcd_8h.html#a5">LcdSelectFont</a>(lcdFont_barchars);00464 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00465 strcpy(displayTitle,<span class="stringliteral">"Treble: "</span>);00466 <a class="code" href="display_8c.html#a5">displayValue</a> = (treble/5)*4;00467 <span class="keywordflow">if</span> (<a class="code" href="display_8c.html#a5">displayValue</a><1) <a class="code" href="display_8c.html#a5">displayValue</a> = 1;00468 <span class="keywordflow">break</span>;00469 00470 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a8">UI_RECLEVEL</a>: <span class="comment">//Show recording level</span>00471 00472 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a>==<a class="code" href="ui_8h.html#a25a23">PS_RECORDING</a>){00473 <a class="code" href="lcd_8h.html#a5">LcdSelectFont</a>(lcdFont_barchars);00474 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00475 strcpy(displayTitle,<span class="stringliteral">"RecLevel"</span>);00476 <a class="code" href="display_8c.html#a5">displayValue</a> = (reclevel);00477 <span class="keywordflow">if</span> (reclevel==0){00478 strcpy(displayTitle,<span class="stringliteral">"RecLevel <Auto> "</span>);00479 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a6">DS_RAWTEXT</a>; <span class="comment">//Reveal the "auto" text</span>00480 }00481 }<span class="keywordflow">else</span>{00482 <span class="comment">//Not in recording</span>00483 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a4">DS_NO_YES</a>;00484 strcpy (displayTitle, <span class="stringliteral">"Record? "</span>);00485 }00486 <span class="keywordflow">break</span>;00487 00488 00489 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a3">UI_SPEC</a>: <span class="comment">// Spectrum analyzer</span>00490 00491 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a23">PS_RECORDING</a>){00492 <a class="code" href="player_8c.html#a6">uiMode</a>++; <span class="comment">//Don't show specana when recording</span>00493 }00494 00495 <a class="code" href="lcd_8h.html#a5">LcdSelectFont</a>(lcdFont_vertical_barchars);00496 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a6">DS_RAWTEXT</a>;00497 <a class="code" href="player_8c.html#a11">ScreenSetPlayTime</a>();00498 00499 <span class="comment">// Request to read Spectrum Analyzer register</span>00500 <a class="code" href="vs10xx_8h.html#a32">Mp3WriteRegister</a>(7, 0x18, 0x04);00501 00502 <span class="comment">// Read Spectrum Analyzer registers</span>00503 {00504 <span class="keywordflow">for</span> (i=0;i<8;i++) { <span class="comment">//for each band i in [0..7]</span>00505 <span class="keywordtype">signed</span> <span class="keywordtype">char</span> thisband = <a class="code" href="vs10xx_8h.html#a38">Mp3ReadRegister</a>(6);00506 00507 <span class="comment">/* thisband now has spectrum value 0..63. We adjust it a little</span>00508 <span class="comment"> for best image on the evakit LCD. You also get peak values</span>00509 <span class="comment"> etc from the chip but we don't use them in the evakit screen.</span>00510 <span class="comment"> we use 8 bands, but up to 23 are obtainable from the chip. */</span>00511 00512 thisband &= 63; <span class="comment">/* mask all but level info */</span>00513 thisband >>= 1; <span class="comment">/* LCD resolution is not high */</span>00514 thisband -= 3; <span class="comment">/* base offset */</span> 00515 <span class="keywordflow">if</span> (i==0) thisband -= 2; <span class="comment">/* decrease bass bar level */</span>00516 <span class="keywordflow">if</span> (i==6) thisband += 1; <span class="comment">/* increase treble bar level */</span>00517 <span class="keywordflow">if</span> (i==7) thisband += 1; <span class="comment">/* increase treble bar level */</span>00518 <span class="keywordflow">if</span> (thisband>7) thisband = 7; <span class="comment">/* high limit */</span>00519 <span class="keywordflow">if</span> (thisband<0) thisband =<span class="charliteral">' '</span>; <span class="comment">/* low limit */</span>00520 00521 <a class="code" href="display_8c.html#a1">displayTitle</a>[i+8] = thisband; <span class="comment">//Store to display mem</span>00522 00523 }<span class="comment">//for each band</span>00524 }00525 <span class="keywordflow">break</span>;00526 00527 } <span class="comment">//switch(uiMode) </span>00528 00529 <span class="comment">// Buttons handler</span>00530 <span class="comment">// Perform mode-dependent button handling</span>00531 00532 <span class="keywordflow">if</span> ((<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>) && (uiReturnDelay < <a class="code" href="player_8c.html#a2">UI_RETURN_DELAY</a>-20)){00533 <a class="code" href="lcd_8c.html#a4">LcdReset</a>();00534 <a class="code" href="player_8c.html#a6">uiMode</a>++;00535 uiReturnDelay = <a class="code" href="player_8c.html#a2">UI_RETURN_DELAY</a>;00536 }00537 00538 <span class="keywordflow">switch</span>(<a class="code" href="player_8c.html#a6">uiMode</a>){00539 00540 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a2">UI_TITLE</a>:00541 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a3">UI_SPEC</a>:00542 00543 <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>){00544 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>; <span class="comment">/* Request */</span>00545 } 00546 <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>){00547 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a15">PS_PREVIOUS_SONG</a>; <span class="comment">/* R
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -