예제 #1
0
/*******************************************************************************
* Function Name  : Mp3Reset
* Description    : Reset the VS1003 chip
* Input          : None.
* Output         : None
* Return         : None
*******************************************************************************/
void Mp3Reset(void)
{
	ControlReset(SET);									//xReset = 0   ��Νvs1003
	Delay(10);							//����ҝ���ֽھ���Ч���ݣ�����SPI����
	SCI_ChipSelect(RESET); 							//xCS = 1
	SDI_ChipSelect(RESET);     								//xDCS = 1
	ControlReset(RESET);								//xRESET = 1
	Delay(10);	           								//��ʹ100ms
	while(DREQ);	//�ȴ�DREQΪ��
    Delay(10);
    Mp3SoftReset();										//vs1003��Ν

}
예제 #2
0
void Play()
{
  playingState = PS_NEXT_SONG;

  currentFile = 1;

 #if defined(__AVR_ATmega1280__)
   // If play/stop button is pressed during boot, enter recording.
  if (0== PSKey)
  {
  	 delay(20);
	 while(0 == PSKey);
	 delay(20);
        Record();
  }
  #endif
  
  //cyclely play 
  while(1)
  {

	 //CheckPlay();
	 CheckKey();
	 	 
	 if(1 ==playStop)
	 {
	 	if(OpenFile(currentFile))
	 	{	
			//if open failed, then try it again
	 		if(OpenFile(currentFile))
			{
				playStop = 0;
				playingState = PS_NEXT_SONG;
  				currentFile = 1;
				continue;
			}
	 	}
		
		PlayCurrentFile();
		if (playingState == PS_PREVIOUS_SONG) currentFile--;
	    if (playingState == PS_NEXT_SONG) currentFile++;
    	if (currentFile==0) currentFile = 1;
     	//if (playingState == PS_END_OF_SONG) playingState = PS_NORMAL; 
		Mp3SoftReset();
	 }
  }
}
예제 #3
0
void VS1053_Start()
{
        ControlReset(SET);
        Delay(100);
        SPIPutChar(0xFF);
        SCI_ChipSelect(RESET);
        SDI_ChipSelect(RESET);
        ControlReset(RESET);
        Mp3SoftReset();
        Delay(100);

        while(GPIO_ReadInputDataBit(DREQ_PORT,DREQ_PIN) == 0);

        Mp3WriteRegister(SPI_MODE,0x08,0x00);
        Mp3WriteRegister(SPI_CLOCKF,0x98,0x00);
        Mp3WriteRegister(SPI_AUDATA,0xAC,0x45);
        Mp3WriteRegister(SPI_BASS,0x08,0x00);
        Mp3WriteRegister(SPI_VOL,0x0B,0x0B);
        Mp3WriteRegister(SPI_STATUS,0,0b00110011);

        while(GPIO_ReadInputDataBit(DREQ_PORT,DREQ_PIN) == 0);
}