예제 #1
0
void main()
{
    unsigned int i;
    WDTCN=0xDE;
    WDTCN=0xAD;
    SYSCLK_Init();
    PORT_Init();
    SPI0_Init();

    Mp3Reset();
    P7 &= ~0x40;
    for (i = 0; i < 15000; ++i)
        send_dat(music[i]);
    flush_buffer();
    while(1);
}
예제 #2
0
파일: main.c 프로젝트: crane-may/cat_ear
int main() {
	int i=0;
	int ret,j;
	static u8 data[512];
	
	
	cur_song_init();
	init_usart();
	initSystick();
	delay(1000);
	printf("\r\n\r\n-------- start -------\r\n");
	
//	shot();
//	while (1);
	
	initSpi();
	SD_Init();
	readBlock(0,data);
	
	init_mp3();
	Mp3Reset();
	mute();
	init_fetch();
	
  //send_fetch_play_list();
  while (1) loop();

// 	println("start shot...");
// 	for(i=1;i<=3573;i++){
// 		readBlock(i,data);
// 		for(j=0;j<512;j++) {
// 			printf("%c",data[j]);
// 		}
// 	}
// 	println("shot over");

// 	println("--- 0");
//  	ret = get_millisecond();
//  	for(i=1;i<1000;i++)
//  		writeBlock(i,data);
// 	readBlock(990,data);
//  	printf("--- %d\r\n",get_millisecond() - ret);
}
예제 #3
0
/*******************************************************************************
* Function Name  : VsSineTest
* Description    : VS1003 sine test
* Input          : None.
* Output         : None
* Return         : None
*******************************************************************************/
void VsSineTest(void)
{
	Mp3PutInReset();  //xReset = 0   ��Νvs1003
	Mp3Reset();
	Delay(1000);//wait(100);        //��ʹ100ms
	SPIPutChar(0xff);//����ҝ���ֽھ���Ч���ݣ�����SPI����
	SCI_ChipSelect(RESET);
	SDI_ChipSelect(RESET);
	Mp3ReleaseFromReset();

	Mp3Reset();
	Delay(500);//wait(100);

	Mp3SetVolume(50,50);//��������

 	Mp3WriteRegister(SPI_MODE,0x08,0x60);//����vs1003�IJ���ģʽ
	Delay(500);
	while(DREQ);     //�ȴ�DREQΪ��

 	SDI_ChipSelect(SET);       //xDCS = 1��ѥ��vs1003�����ݽӿ�

 	//��vs1003�������Ҳ������0x53 0xef 0x6e n 0x00 0x00 0x00 0x00
 	//����n = 0x24, �蜨vs1003�����������Ҳ���ƾ��־��������㡽����vs1003��datasheet
    SPIPutChar(0x53);
	SPIPutChar(0xef);
	SPIPutChar(0x6e);
	SPIPutChar(0x24);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	Delay(1000);
	SDI_ChipSelect(RESET);//����ִ�о������ӌ���ܴӜ�������ҝ����ҝƾ�ʾ�����

    //�˳����Ҳ���
	SDI_ChipSelect(SET);
	SPIPutChar(0x45);
	SPIPutChar(0x78);
	SPIPutChar(0x69);
	SPIPutChar(0x74);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	Delay(1000);
	SDI_ChipSelect(RESET);

    //�ٴν������Ҳ��Բ�����n־Ϊ0x44���������Ҳ���ƾ������Ϊ�����־
    SDI_ChipSelect(SET);
	SPIPutChar(0x53);
	SPIPutChar(0xef);
	SPIPutChar(0x6e);
	SPIPutChar(0x44);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	Delay(1000);
	SDI_ChipSelect(RESET);

	//�˳����Ҳ���
	SDI_ChipSelect(SET);
	SPIPutChar(0x45);
	SPIPutChar(0x78);
	SPIPutChar(0x69);
	SPIPutChar(0x74);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	SPIPutChar(0x00);
	Delay(1000);
	SDI_ChipSelect(RESET);

 }