Example #1
0
void
testLcd(void)
{
  initLCD();
  lcdBacklight(FALSE);
  osSleep(10);
  unsigned char awaitLoop = 1;
  for(;;)
  {
 	clearScr();

// 	if(displayMode == 1)
// 	{
// 		//writeLCD(1, numberToChar(currentSongInfo.time));
// 		unsigned char toWrite[6];
// 		timeToString(currentSongInfo.time, toWrite);
// 		WriteString(toWrite);
// 		osSleep(10);
// 		continue;
// 	}

 	if(volumeUp != 0 || volumeDown != 0)
 	{
 		writeLCD(1, numberToChar(currentVolume));
 		if(volumeUp != 0) volumeUp = 0;
 		if(volumeDown != 0) volumeDown = 0;
 		awaitLoop = 0;
 	}
 	else if(isError == 0)
	{
		WriteString(currentSongInfo.name);

		//move curstor to second row
		writeLCD(0, 0x80 | 0x40);
		delay37us();

		WriteString(currentSongInfo.author);
	}
	else
	{
		WriteString(error);
	}

    osSleep(50);
    osSleep(1); //actually only 1.52 mS needed

    // awaiting command from joystick
    if(awaitLoop != 0)
    {
    	for(;;)
    	    {
    	    	if(changeLeft != 0)
    	    	{
    	    		changeLeft = 0;
    	    		break;
    	    	}
    	    	if(changeRight != 0)
    	    	{
    	    	    changeRight = 0;
    	    	    break;
    	    	}
    	    	if(volumeUp != 0)
    	    	{
    	    		break;
    	    	}
    	    	if(volumeDown != 0)
    	    	{
    	    		break;
    	    	}
    	    	if(isError != 0)
    	    	{
    	    		break;
    	    	}
    	    	if(currentDisplayMode != displayMode)
    	    	{
    	    		currentDisplayMode = displayMode;
    	    		break;
    	    	}

    	    	osSleep(100);
    	    	if(currentSongInfo.nameLength > 16 || currentSongInfo.authorLength > 16)
    	    	{
    	    		ScreenShiftLeft();
    	    	}
    	    }
    }
    if(awaitLoop == 0) awaitLoop = 1;
  }
	//lcdBacklight(FALSE);
}
Example #2
0
void decodeSubstitution(char *c)
{
    char number = (charToNumber(c) - 30) % 67;
    if (number < 0) number += 67;
    putchar(numberToChar(&number));
}