VLSI Solution Oy VS1103 VLSI Solution Karaoke, MIDI and ADPCM Player Source Code Documentation

Main Page | Class List | File List | Class Members | File Members | Related Pages

display.c File Reference

Functions for high level display. More...

#include "display.h"
#include "lcd.h"
#include "board.h"
#include "string.h"
#include "ui.h"
#include "vs10xx.h"

Include dependency graph for display.c:

Include dependency graph

Go to the source code of this file.

Classes

struct  displayItemStruct

Functions

void SetDisplayTitle (char n, char *s)
void SetDisplaySignedValue (char n, int i)
void SetDisplayText (char n, char *s)
void SetDisplayPercent (char n, char displayValue)
unsigned char PlayerTaskHandler ()
 Check status of buffers and do one disk block transfer.
void UpdateDisplay (unsigned char n)
 Paint display.

Variables

xdata unsigned char displayTimeCount
xdata struct displayItemStruct displayItem [DISPLAY_ITEMS]
bit lyricsDisplay
xdata unsigned char lyrics [40]


Detailed Description

Functions for high level display.

Definition in file display.c.


Function Documentation

unsigned char PlayerTaskHandler  ) 
 

Check status of buffers and do one disk block transfer.

Definition at line 189 of file player.c.

Referenced by AvailableProcessorTime(), main(), and UpdateDisplay().

00189                                   {  
00190   //_____________________________________________________
00191   // WAV playing ----------------------------------------
00192   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00193 
00194 
00195   // Highest priority: WAVE IN stream is SDI stream in
00196   // Check whether SDI in stream has space for 1 disk sector
00197   if ((waveSdiActive) && (MP3_DREQ)){    
00198     GREEN_LED=LED_ON;
00199 
00200     SelectDisk(waveDisk);
00201     TransferSectorSDI(waveCurrentSector); //Send WAV to VS1103
00202 
00203     // Find next sector or end of file
00204     waveCurrentSector++;
00205     if (waveSectorsLeftInFragment-- == 0){
00206       waveCurrentFragment++;
00207       waveCurrentSector = waveFragment[waveCurrentFragment].start;
00208       waveSectorsLeftInFragment = waveFragment[waveCurrentFragment].length;
00209       if (waveSectorsLeftInFragment == 0) {
00210         waveSdiActive = 0;
00211       }      
00212     }
00213     GREEN_LED=LED_OFF;
00214     return 1;
00215   }
00216 
00217 
00218 
00219   //_____________________________________________________
00220   //Recording -------------------------------------------
00221   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00222 
00223 
00224   if ((recordActive) && ((Mp3ReadRegister(SCI_IN1) >> 8) >= 0x20)){
00225     //Sector is available for storing
00226     
00227     // EA=0;
00228     // BlockReceive in C
00229     dataBufPtr = diskSect.raw.buf;
00230     // Use global pointer and unrolled loop for speed
00231     while (dataBufPtr < diskSect.raw.buf+512){
00232 
00233 
00234       // Below is the spi data transfer code in ASSEMBLER 
00235       // (for super fast data read from VS1103) and also in C.
00236 
00237       // READ ONE SECTOR (512 bytes) FROM VS1103 REC BUFFER
00238       // TO DISKSECT.RAW.BUF[512]
00239 
00240 #if 1
00241 _asm
00242 
00243   push dpl
00244   push dph
00245   push psw
00246   push acc
00247   mov   dpl,_dataBufPtr
00248   mov   dph,(_dataBufPtr + 1)
00249 
00250 
00251   // CHIP SELECT
00252   clr   _P2_3
00253   mov   _SPDAT,#0x03
00254   mov   a,_SPSTA
00255   jnb     acc.7,.-4
00256   mov   _SPDAT,#0x08
00257   mov   a,_SPSTA
00258   jnb     acc.7,.-4
00259   mov   _SPDAT,#0xFF
00260   mov   a,_SPSTA
00261   jnb     acc.7,.-4
00262   mov   a,_SPDAT
00263 
00264 
00265   mov   _SPDAT,#0xFF
00266   movx @dptr,a
00267   inc dptr
00268   // CHIP DESELECT
00269   setb  _P2_3
00270   // CHIP SELECT
00271   clr   _P2_3
00272   mov   a,_SPDAT
00273   mov   _SPDAT,#0x03
00274   movx  @dptr,a
00275   mov   _SPDAT,#0x08
00276   inc dptr  
00277   mov   a,_SPSTA
00278   mov   _SPDAT,#0xFF
00279   nop
00280   nop
00281   nop
00282   mov   a,_SPSTA
00283   mov   a,_SPDAT
00284 
00285 
00286   mov   _SPDAT,#0xFF
00287   movx @dptr,a
00288   inc dptr
00289   // CHIP DESELECT
00290   setb  _P2_3
00291   // CHIP SELECT
00292   clr   _P2_3
00293   mov   a,_SPDAT
00294   mov   _SPDAT,#0x03
00295   movx  @dptr,a
00296   mov   _SPDAT,#0x08
00297   inc dptr  
00298   mov   a,_SPSTA
00299   mov   _SPDAT,#0xFF
00300   nop
00301   nop
00302   nop
00303   mov   a,_SPSTA
00304   mov   a,_SPDAT
00305 
00306 
00307   mov   _SPDAT,#0xFF
00308   movx @dptr,a
00309   inc dptr
00310   // CHIP DESELECT
00311   setb  _P2_3
00312   // CHIP SELECT
00313   clr   _P2_3
00314   mov   a,_SPDAT
00315   mov   _SPDAT,#0x03
00316   movx  @dptr,a
00317   mov   _SPDAT,#0x08
00318   inc dptr  
00319   mov   a,_SPSTA
00320   mov   _SPDAT,#0xFF
00321   nop
00322   nop
00323   nop
00324   mov   a,_SPSTA
00325   mov   a,_SPDAT
00326 
00327 
00328   mov   _SPDAT,#0xFF
00329   movx @dptr,a
00330   inc dptr
00331   // CHIP DESELECT
00332   setb  _P2_3
00333   // CHIP SELECT
00334   clr   _P2_3
00335   mov   a,_SPDAT
00336   mov   _SPDAT,#0x03
00337   movx  @dptr,a
00338   mov   _SPDAT,#0x08
00339   inc dptr  
00340   mov   a,_SPSTA
00341   mov   _SPDAT,#0xFF
00342   nop
00343   nop
00344   nop
00345   mov   a,_SPSTA
00346   mov   a,_SPDAT
00347 
00348 
00349   mov   _SPDAT,#0xFF
00350   movx @dptr,a
00351   inc dptr
00352   // CHIP DESELECT
00353   setb  _P2_3
00354   // CHIP SELECT
00355   clr   _P2_3
00356   mov   a,_SPDAT
00357   mov   _SPDAT,#0x03
00358   movx  @dptr,a
00359   mov   _SPDAT,#0x08
00360   inc dptr  
00361   mov   a,_SPSTA
00362   mov   _SPDAT,#0xFF
00363   nop
00364   nop
00365   nop
00366   mov   a,_SPSTA
00367   mov   a,_SPDAT
00368 
00369 
00370   mov   _SPDAT,#0xFF
00371   movx @dptr,a
00372   inc dptr
00373   // CHIP DESELECT
00374   setb  _P2_3
00375   // CHIP SELECT
00376   clr   _P2_3
00377   mov   a,_SPDAT
00378   mov   _SPDAT,#0x03
00379   movx  @dptr,a
00380   mov   _SPDAT,#0x08
00381   inc dptr  
00382   mov   a,_SPSTA
00383   mov   _SPDAT,#0xFF
00384   nop
00385   nop
00386   nop
00387   mov   a,_SPSTA
00388   mov   a,_SPDAT
00389 
00390 
00391   mov   _SPDAT,#0xFF
00392   movx @dptr,a
00393   inc dptr
00394   // CHIP DESELECT
00395   setb  _P2_3
00396   // CHIP SELECT
00397   clr   _P2_3
00398   mov   a,_SPDAT
00399   mov   _SPDAT,#0x03
00400   movx  @dptr,a
00401   mov   _SPDAT,#0x08
00402   inc dptr  
00403   mov   a,_SPSTA
00404   mov   _SPDAT,#0xFF
00405   nop
00406   nop
00407   nop
00408   mov   a,_SPSTA
00409   mov   a,_SPDAT
00410 
00411 
00412   mov   _SPDAT,#0xFF
00413   movx @dptr,a
00414   inc dptr
00415   mov   a,_SPSTA
00416   mov   a,_SPDAT
00417   movx  @dptr,a
00418   inc dptr
00419 
00420   // CHIP DESELECT
00421   setb  _P2_3
00422   
00423   mov   _dataBufPtr, dpl
00424   mov   (_dataBufPtr + 1), dph
00425   pop acc
00426   pop psw
00427   pop dph
00428   pop dpl
00429 
00430 
00431 _endasm;
00432 
00433 #else
00434       Mp3SelectControl();
00435       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00436       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00437       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00438       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00439       Mp3DeselectControl();
00440 
00441 
00442       Mp3SelectControl();
00443       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00444       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00445       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00446       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00447       Mp3DeselectControl();
00448 
00449 
00450       Mp3SelectControl();
00451       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00452       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00453       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00454       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00455       Mp3DeselectControl();
00456 
00457 
00458       Mp3SelectControl();
00459       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00460       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00461       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00462       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00463       Mp3DeselectControl();
00464 
00465 
00466       Mp3SelectControl();
00467       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00468       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00469       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00470       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00471       Mp3DeselectControl();
00472 
00473 
00474       Mp3SelectControl();
00475       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00476       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00477       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00478       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00479       Mp3DeselectControl();
00480 
00481 
00482       Mp3SelectControl();
00483       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00484       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00485       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00486       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00487       Mp3DeselectControl();
00488 
00489 
00490       Mp3SelectControl();
00491       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00492       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00493       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00494       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00495       Mp3DeselectControl();
00496 
00497 
00498 #endif
00499 
00500     }
00501     //ConsolePutChar('w');
00502 
00503     EA=1;
00504 
00505     
00506     RED_LED = LED_ON;
00507     sectorAddress.l = recordCurrentSector;
00508     recordCurrentSector++;
00509 
00510     SelectDisk(recordDisk);
00511     WriteDiskSector(sectorAddress.l);
00512     RED_LED = LED_OFF;
00513     
00514     recordSectorsLeftInFragment--;
00515     if (recordSectorsLeftInFragment<1) recordActive = 0;
00516     
00517     return 2;
00518 
00519   }
00520 
00521   //_____________________________________________________
00522   //   ECHO   -------------------------------------------
00523   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00524 
00525 
00526   if ((echoActive  ) && ((Mp3ReadRegister(SCI_IN1) >> 8) >= 0x20)){
00527     
00528     // EA=0;
00529     // BlockReceive in C
00530     dataBufPtr = diskSect.raw.buf;
00531     // Use global pointer and unrolled loop for speed
00532     while (dataBufPtr < diskSect.raw.buf+256){
00533    
00534       //Similar fast transfer than in the recording mode 
00535       // -> record and send back to VS1103 to make echo from the microphone
00536    
00537 _asm
00538 
00539   push dpl
00540   push dph
00541   push psw
00542   push acc
00543   mov   dpl,_dataBufPtr
00544   mov   dph,(_dataBufPtr + 1)
00545 
00546 
00547   // CHIP SELECT
00548   clr   _P2_3
00549   mov   _SPDAT,#0x03
00550   mov   a,_SPSTA
00551   jnb     acc.7,.-4
00552   mov   _SPDAT,#0x08
00553   mov   a,_SPSTA
00554   jnb     acc.7,.-4
00555   mov   _SPDAT,#0xFF
00556   mov   a,_SPSTA
00557   jnb     acc.7,.-4
00558   mov   a,_SPDAT
00559 
00560 
00561   mov   _SPDAT,#0xFF
00562   movx @dptr,a
00563   inc dptr
00564   // CHIP DESELECT
00565   setb  _P2_3
00566   // CHIP SELECT
00567   clr   _P2_3
00568   mov   a,_SPDAT
00569   mov   _SPDAT,#0x03
00570   movx  @dptr,a
00571   mov   _SPDAT,#0x08
00572   inc dptr  
00573   mov   a,_SPSTA
00574   mov   _SPDAT,#0xFF
00575   nop
00576   nop
00577   nop
00578   mov   a,_SPSTA
00579   mov   a,_SPDAT
00580 
00581 
00582   mov   _SPDAT,#0xFF
00583   movx @dptr,a
00584   inc dptr
00585   // CHIP DESELECT
00586   setb  _P2_3
00587   // CHIP SELECT
00588   clr   _P2_3
00589   mov   a,_SPDAT
00590   mov   _SPDAT,#0x03
00591   movx  @dptr,a
00592   mov   _SPDAT,#0x08
00593   inc dptr  
00594   mov   a,_SPSTA
00595   mov   _SPDAT,#0xFF
00596   nop
00597   nop
00598   nop
00599   mov   a,_SPSTA
00600   mov   a,_SPDAT
00601 
00602 
00603   mov   _SPDAT,#0xFF
00604   movx @dptr,a
00605   inc dptr
00606   // CHIP DESELECT
00607   setb  _P2_3
00608   // CHIP SELECT
00609   clr   _P2_3
00610   mov   a,_SPDAT
00611   mov   _SPDAT,#0x03
00612   movx  @dptr,a
00613   mov   _SPDAT,#0x08
00614   inc dptr  
00615   mov   a,_SPSTA
00616   mov   _SPDAT,#0xFF
00617   nop
00618   nop
00619   nop
00620   mov   a,_SPSTA
00621   mov   a,_SPDAT
00622 
00623 
00624   mov   _SPDAT,#0xFF
00625   movx @dptr,a
00626   inc dptr
00627   // CHIP DESELECT
00628   setb  _P2_3
00629   // CHIP SELECT
00630   clr   _P2_3
00631   mov   a,_SPDAT
00632   mov   _SPDAT,#0x03
00633   movx  @dptr,a
00634   mov   _SPDAT,#0x08
00635   inc dptr  
00636   mov   a,_SPSTA
00637   mov   _SPDAT,#0xFF
00638   nop
00639   nop
00640   nop
00641   mov   a,_SPSTA
00642   mov   a,_SPDAT
00643 
00644 
00645   mov   _SPDAT,#0xFF
00646   movx @dptr,a
00647   inc dptr
00648   // CHIP DESELECT
00649   setb  _P2_3
00650   // CHIP SELECT
00651   clr   _P2_3
00652   mov   a,_SPDAT
00653   mov   _SPDAT,#0x03
00654   movx  @dptr,a
00655   mov   _SPDAT,#0x08
00656   inc dptr  
00657   mov   a,_SPSTA
00658   mov   _SPDAT,#0xFF
00659   nop
00660   nop
00661   nop
00662   mov   a,_SPSTA
00663   mov   a,_SPDAT
00664 
00665 
00666   mov   _SPDAT,#0xFF
00667   movx @dptr,a
00668   inc dptr
00669   // CHIP DESELECT
00670   setb  _P2_3
00671   // CHIP SELECT
00672   clr   _P2_3
00673   mov   a,_SPDAT
00674   mov   _SPDAT,#0x03
00675   movx  @dptr,a
00676   mov   _SPDAT,#0x08
00677   inc dptr  
00678   mov   a,_SPSTA
00679   mov   _SPDAT,#0xFF
00680   nop
00681   nop
00682   nop
00683   mov   a,_SPSTA
00684   mov   a,_SPDAT
00685 
00686 
00687   mov   _SPDAT,#0xFF
00688   movx @dptr,a
00689   inc dptr
00690   // CHIP DESELECT
00691   setb  _P2_3
00692   // CHIP SELECT
00693   clr   _P2_3
00694   mov   a,_SPDAT
00695   mov   _SPDAT,#0x03
00696   movx  @dptr,a
00697   mov   _SPDAT,#0x08
00698   inc dptr  
00699   mov   a,_SPSTA
00700   mov   _SPDAT,#0xFF
00701   nop
00702   nop
00703   nop
00704   mov   a,_SPSTA
00705   mov   a,_SPDAT
00706 
00707 
00708   mov   _SPDAT,#0xFF
00709   movx @dptr,a
00710   inc dptr
00711   mov   a,_SPSTA
00712   mov   a,_SPDAT
00713   movx  @dptr,a
00714   inc dptr
00715 
00716   // CHIP DESELECT
00717   setb  _P2_3
00718   
00719   mov   _dataBufPtr, dpl
00720   mov   (_dataBufPtr + 1), dph
00721   pop acc
00722   pop psw
00723   pop dph
00724   pop dpl
00725 
00726 
00727 _endasm;
00728 
00729  
00730     }
00731     //ConsolePutChar('w');
00732     
00733     EA=1;
00734     
00735 
00736     //while (MP3_DREQ){
00737     
00738       Mp3SelectData();
00739       // BlockTransmit in C
00740       dataBufPtr = diskSect.raw.buf;
00741       // Use global pointer and unrolled loop for speed
00742       while (dataBufPtr < diskSect.raw.buf+256){
00743         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00744         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00745         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00746         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00747         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00748         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00749         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00750         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00751         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00752         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00753         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00754         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00755         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00756         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00757         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00758         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00759       }
00760       Mp3DeselectData();
00761       //}
00762     return 2;
00763 
00764   }
00765 
00766 
00767   //_____________________________________________________
00768   // MIDI playing ---------------------------------------
00769   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00770 
00771   
00772   // MIDI IN stream is SCI stream in
00773   // Check whether SCI in stream has space for 1 disk sector
00774   if (midiSciActive && (Mp3ReadRegister(SCI_IN1) & 0xff) >= 0x20){
00775     LED1 = LED_ON;
00776 
00777     SelectDisk(midiDisk);
00778     TransferSectorSCI(midiCurrentSector); //Send MID to VS1103
00779 
00780     // Find next sector or end of file
00781     midiCurrentSector++;
00782     if (midiSectorsLeftInFragment-- == 0){
00783       midiCurrentFragment++;
00784       midiCurrentSector = midiFragment[midiCurrentFragment].start;
00785       midiSectorsLeftInFragment = midiFragment[midiCurrentFragment].length;
00786       if (midiSectorsLeftInFragment == 0) {
00787         midiSciActive = 0;
00788       }      
00789     }
00790 
00791     LED1=LED_OFF;
00792     return 3;
00793   }
00794     
00795   return 0; //No transfer was pending.
00796 }

void SetDisplayPercent char  n,
char  displayValue
 

Definition at line 52 of file display.c.

References displayItem, temp, and displayItemStruct::text.

Referenced by AvailableProcessorTime(), EchoEnable(), and main().

00052                                                   {
00053     unsigned char temp,majorp, minorp;
00054     if (displayValue>100){
00055       displayValue=100;
00056     }
00057     majorp = (displayValue-4) / 12;
00058     minorp = ((displayValue-4) % 12) >> 1;
00059     for (temp=0; temp<8; temp++){
00060       if (majorp>temp){
00061         displayItem[n].text[temp] = 4;
00062       }else{
00063         if (majorp<temp){
00064           displayItem[n].text[temp] = ' ';
00065         }else{
00066           switch(minorp){
00067           case 0:
00068             displayItem[n].text[temp] = ' ';
00069             break;
00070           case 1:
00071             displayItem[n].text[temp] = 0;
00072             break;
00073           case 2:
00074             displayItem[n].text[temp] = 1;
00075             break;
00076           case 3:
00077             displayItem[n].text[temp] = 2;
00078             break;
00079           case 4:
00080             displayItem[n].text[temp] = 3;
00081             break;
00082           case 5:
00083             displayItem[n].text[temp] = 4;
00084             break;
00085           }//switch
00086         }
00087       }
00088     }       
00089     displayItem[n].text[8] = ' ';
00090     displayItem[n].text[9] = ' ';
00091     if (displayValue>99) displayItem[n].text[9]='1';
00092     displayItem[n].text[10] = ' ';
00093     if (displayValue>9) displayItem[n].text[10]='0' + ((displayValue / 10) % 10);
00094     displayItem[n].text[11]='0' + (displayValue % 10);
00095     
00096 }

void SetDisplaySignedValue char  n,
int  i
 

Definition at line 24 of file display.c.

References displayItem, and displayItemStruct::text.

Referenced by AvailableProcessorTime(), and main().

00024                                          {
00025   bit negative;
00026   char c;
00027   negative = 0;
00028   if (i<0){
00029     negative = 1;
00030     i = -i;
00031   }
00032   for (c=0; c<12; c++) displayItem[n].text[c] = ' ';
00033   c=2;
00034   if (i>99) c=3;
00035   if (i>999) c=6;
00036   do {
00037     displayItem[n].text[c--] = '0' + (i % 10);
00038     i /= 10; 
00039   }  while (i);
00040   if (negative){
00041     displayItem[n].text[c] = '-';
00042   } else {
00043     displayItem[n].text[c] = '+';
00044   }      
00045 }

void SetDisplayText char  n,
char *  s
 

Definition at line 47 of file display.c.

References displayItem, and displayItemStruct::text.

Referenced by AvailableProcessorTime(), CancelMidi(), CancelRecord(), CancelWave(), EchoEnable(), main(), SelectMidiFile(), SelectRecordFile(), SelectWaveFile(), SetMidiFromFile(), and SetMidiFromUART().

00047                                     {
00048   char c;
00049   for (c=0; c<12; c++) displayItem[n].text[c] = s[c];
00050 }

void SetDisplayTitle char  n,
char *  s
 

Definition at line 19 of file display.c.

References displayItem, and displayItemStruct::title.

Referenced by main().

00019                                      {
00020   char c; 
00021   for (c=0; c<12; c++) displayItem[n].title[c] = s[c];
00022 }

void UpdateDisplay unsigned char  n  ) 
 

Paint display.

Definition at line 106 of file display.c.

References Temp::b, Temp::b0, Temp::b1, displayItem, displayTimeCount, Temp::i, LcdLocateHome, LcdLocateLine2, LcdPutChar(), LcdPutConstantString(), lyrics, Mp3ReadRegister(), Mp3WriteRegister, PlayerTaskHandler(), SCI_WRAM, SCI_WRAMADDR, temp, and UI_END_OF_MODES.

Referenced by AvailableProcessorTime(), and SelectWaveFile().

00106                                    {
00107   char i;
00108   static xdata char poly[16];
00109   
00110   PlayerTaskHandler();
00111   LcdLocateHome();
00112  
00113   if (n<1) {
00114 #if 0
00115     LcdPutConstantString("  *VS1103*  ");
00116 #else
00117     for (i=0; i<15; i++){
00118       unsigned char nn;
00119       temp.i = 1641 + i*19;
00120       Mp3WriteRegister(SCI_WRAMADDR, temp.b.b1, temp.b.b0);
00121       nn = Mp3ReadRegister(SCI_WRAM);
00122       if (nn){  
00123         if (nn>poly[i]){
00124           LcdPutChar(0xff);
00125         } else {
00126           LcdPutChar('0'+((i+1)%10));
00127         }      
00128       }else{
00129         LcdPutChar(' ');
00130       }
00131       poly[i]=nn;
00132     }   
00133     LcdPutConstantString("    ");
00134 #endif    
00135   }else{
00136     for (i=0; i<12; i++){
00137       PlayerTaskHandler();
00138       LcdPutChar(displayItem[n-1].title[i]);
00139     }
00140   }
00141 
00142   if (displayTimeCount & 0x10){
00143     //LcdPutConstantString("\xa2\xff");
00144     LcdPutConstantString(" \xff");
00145   }else{
00146     //LcdPutConstantString("\xa2 ");
00147     LcdPutConstantString("  ");
00148   }
00149 
00150   for (i=0; i<12; i++){
00151     PlayerTaskHandler();
00152     LcdPutChar(displayItem[n].title[i]);
00153   }
00154   //LcdPutConstantString(" \x7c");
00155   LcdPutConstantString("  ");
00156 
00157   if (n==0) {
00158     LcdPutConstantString("     ");
00159   }else{
00160     if (n>UI_END_OF_MODES-2) {
00161       LcdPutConstantString("            ");
00162     }else{
00163       for (i=0; i<12; i++){
00164         LcdPutChar(displayItem[n+1].title[i]);
00165       }
00166     }
00167   }
00168 
00169 
00170   PlayerTaskHandler();
00171   LcdLocateLine2();
00172   PlayerTaskHandler();
00173 
00174 
00175   if (lyricsDisplay){
00176     for (i=0; i<40; i++){
00177       PlayerTaskHandler();
00178       LcdPutChar(lyrics[i]);
00179     }
00180   } else {
00181     
00182     if (n<1) {
00183 
00184 
00185 #if 1
00186       LcdPutConstantString("^Channel Activity^ ");
00187 #else
00188     for (i=8; i<16; i++){
00189       unsigned char n;
00190       temp.i = 1641 + i*19;
00191       Mp3WriteRegister(SCI_WRAMADDR, temp.b.b1, temp.b.b0);
00192       n = Mp3ReadRegister(SCI_WRAM);
00193       if (n>poly[i]){
00194         LcdPutChar('0'+((i+1)%10));
00195       }else{
00196         LcdPutChar(' ');
00197       }
00198       poly[i]=n;
00199     }   
00200     LcdPutConstantString("    ");
00201 #endif    
00202 
00203     }else{
00204       for (i=0; i<12; i++){
00205         PlayerTaskHandler();
00206         LcdPutChar(displayItem[n-1].text[i]);
00207       }
00208     }
00209     if (displayTimeCount & 0x10){
00210       //    LcdPutConstantString("\x7c ");
00211       LcdPutConstantString("  ");
00212     }else{
00213       //    LcdPutConstantString("\x7c\xff");
00214       LcdPutConstantString(" \xff");
00215     }
00216     
00217     
00218     
00219     for (i=0; i<12; i++){
00220       PlayerTaskHandler();
00221       LcdPutChar(displayItem[n].text[i]);
00222     }
00223     //LcdPutConstantString(" \xa3");
00224     LcdPutConstantString("  ");
00225     if (n==0) {
00226       LcdPutConstantString("..-->");
00227     }else{
00228       if (n>UI_END_OF_MODES-2) {
00229         LcdPutConstantString("            ");
00230       }else{
00231         for (i=0; i<12; i++){
00232           PlayerTaskHandler();
00233           LcdPutChar(displayItem[n+1].text[i]);
00234         }
00235       }
00236     }
00237   }  
00238 
00239 }

Here is the call graph for this function:


Variable Documentation

xdata struct displayItemStruct displayItem[DISPLAY_ITEMS]
 

Referenced by SetDisplayPercent(), SetDisplaySignedValue(), SetDisplayText(), SetDisplayTitle(), and UpdateDisplay().

xdata unsigned char displayTimeCount
 

Definition at line 12 of file display.c.

Referenced by timer0_interrupt(), and UpdateDisplay().

xdata unsigned char lyrics[40]
 

Definition at line 68 of file player.c.

Referenced by main(), SelectMidiFile(), and UpdateDisplay().

bit lyricsDisplay
 

Definition at line 58 of file player.c.

Referenced by AvailableProcessorTime(), and main().


All software copyright 2000-2004 VLSI Solution OY. Redistribution of these software modules is limited to VLSI Solution Oy chip promotional use only. Free or commercial use of these software modules in MP3 players is ok if the product includes chip(s) from VLSI. You can request the complete (compilable) package from mp3@vlsi.fi. This exampe code is provided with good faith to assist You in code development, but under no circumstances will VLSI offer any guarantees on the usability or functionality of any example software or its fitness for any purpose.