void APP_Run(void) { SHELL_Init(); /* initialize shell */ VS_Init(); /* initialize VS1053B module */ #if RADIO RNETA_Init(); #endif #if PLAYER PLR_Init(); #endif FRTOS1_vTaskStartScheduler(); }
void main() { FATFS fs; FIL file; InitMCU(); //VS_SinTest(0x74); VS_Init(); if(disk_initialize(0)) ConsoleWrite("Disk Initialization FAILED. :(\n"); else ConsoleWrite("Disk Initialization Complete.\n"); if(f_mount(0,&fs)) ConsoleWrite("Mount FieSystem Failed\n"); else ConsoleWrite("Mount FileSystem Success!\n"); ConsoleWrite("Scaning Music Files...\n\n"); if(scan_files("/",&(Player.TotalSongNum))) ConsoleWrite("Scan Files Failed\n"); else{ ConsoleWrite("\nScan Files Accomplished.\ntotal files: "); ConsolePutUInt (Player.TotalSongNum); ConsoleWrite ("\n\n");} if(scan_files_open (&file,"/",1)) // Start node to be scanned and opened ConsoleWrite("Open File Error\n"); //Playing mp3/track001.mp3 ... will apear in function Player.currFile = &file; Player.SongNum = 1; Player.Status = PS_PLAYING; Player.Mode = SM_SONG; Player.Volume = 170; Player.Bass = 7; Player.Treble = 0; VS_SetBassTreble(Player.Bass,Player.Treble); BufCnt = 0; // GenerateEvent(EV_BUFEMPTY); //Main loop while(1) { //Get system event Player.Event = GetEvent(); //Handle Events HandleEvent(); } }
int main() { if(!VS_Init()) // Init vshell return 0; if(!VS_Bind("../../../input/bugs720x576x20.avi")) // Input video stream return 0; int width =VS_GetWidth (VS_SOURCE); // Get width of video frame int height=VS_GetHeight(VS_SOURCE); // Get height of video frame int size =width*height; VS_CreateImage("Source Image", 1, width, height, VS_RGB8, 0); // Create window for grayscale drawing of 8-bit source image VS_CreateImage("Sobel Image", 2, width, height, VS_RGB8, 0); // Create window for grayscale drawing of 8-bit result image NmppsFrame_8u srcFrame; NmppsFrame_8u dstFrame; unsigned char* srcImg8=(unsigned char*) nmppsMallocFrame_8u(size,width,&srcFrame); // Allocate source image buffer with guard fields of two rows unsigned char* dstImg8=(unsigned char*) nmppsMallocFrame_8u(size,width,&dstFrame); // Allocate result image buffer CSobel sobel(width, height); while(VS_Run()) { VS_GetGrayData(VS_SOURCE, srcImg8); // Get image from video stream VS_SetData(1, srcImg8); // Put source image in window 1 sobel.filter(srcImg8, dstImg8); VS_SetData(2, dstImg8); VS_Draw(VS_DRAW_ALL); } nmppsFree(srcFrame.pull); // Free source image buffer nmppsFree(dstFrame.pull); // Free result image buffer return 0; }
int main() { // Access and loading program to nm-board C_PC_Connector_mc5103 Connector(PROGRAM); if (!Connector.isConnected()){ printf("Connection to mc5103 error!"); return -1; } int handshake= Connector.Sync(0xC0DE0086); if (handshake!=0xC0DE6406){ printf("Handshake with mc5103 error!"); return -1; } if(!VS_Init()) return 0; //if(!VS_Bind("//dragon/distrib/streams/video/720x576/bugs.avi")) if(!VS_Bind("../../../../input/bugs720x576x20.avi")) return 0; int width =VS_GetWidth (VS_SOURCE); int height=VS_GetHeight(VS_SOURCE); int size =width*height; VS_CreateImage("Source Image", 1, width, height, VS_RGB8, 0); // Create window for 8-bit source grayscale image VS_CreateImage("Sobel Image", 2, width, height, VS_RGB8, 0); // Create window for 8-bit result grayscale image Connector.Sync(width); // Send width to nmc Connector.Sync(height); // Send height to nmc int ok=Connector.Sync(0); // Get status of memory allocation from nm if (ok!=0x600DB00F){ printf("Memory allocation error!"); return -1; } unsigned srcAddr=Connector.Sync(0); unsigned dstAddr=Connector.Sync(0); unsigned char* srcImg8= new unsigned char [size]; unsigned char* dstImg8= new unsigned char [size]; while(VS_Run()) { VS_GetGrayData(VS_SOURCE, srcImg8); // Get image from video stream VS_SetData(1, srcImg8); // Put source image in window ?1 Connector.WriteMemBlock((unsigned*)srcImg8, srcAddr, size/4); Connector.Sync(0); //... wait while sobel runs on board unsigned t=Connector.Sync(0); Connector.ReadMemBlock ((unsigned*)dstImg8, dstAddr, size/4); if (t==0xDEADB00F) VS_Text("Memory allocation error in sobel!\r\n"); VS_SetData(2, dstImg8); VS_Text("%u clocks per frame , %.2f clocks per pixel, %.2f fps\r\n", t, 1.0*t/size, 320000000.0/t ); VS_Draw(VS_DRAW_ALL); } delete srcImg8; delete dstImg8; return 0; }
int main(int arcg) { // Access and loading program to nm-board C_PC_Connector_mb7707 Connector(MAC_ADDRESS,PROGRAM); if (!Connector.isConnected()){ printf("Connection to mc5103 error!"); return -1; } access=Connector.access; int handshake= Connector.Sync(0xC0DE0086); if (handshake!=0xC0DE6406){ printf("Handshake with mc5103 error!"); return -1; } if(!VS_Init()) return 0; if(!VS_Bind("../../../../input/Lena224x240.bmp")) return 0; int width =VS_GetWidth (VS_SOURCE); int height=VS_GetHeight(VS_SOURCE); int size =width*height; VS_CreateImage("Source Image", 1, width, height, VS_RGB8, 0); // Create window for 8-bit source grayscale image VS_CreateImage("Sobel Image", 2, width, height, VS_RGB8, 0); // Create window for 8-bit result grayscale image Connector.Sync(width); // Send width to nmc Connector.Sync(height); // Send height to nmc int ok=Connector.Sync(0); // Get status of memory allocation from nm if (ok!=0x600DB00F){ printf("Memory allocation error!"); return -1; } unsigned srcAddr=Connector.Sync(0); unsigned dstAddr=Connector.Sync(0); unsigned char* srcImg8= new unsigned char [size]; unsigned char* dstImg8= new unsigned char [size]; while(VS_Run()) { VS_GetGrayData(VS_SOURCE, srcImg8); // Get image from video stream VS_SetData(1, srcImg8); // Put source image in window ?1 Connector.WriteMemBlock((unsigned*)srcImg8, srcAddr, size/4); Connector.Sync(0); //... wait while sobel runs on board unsigned t=Connector.Sync(0); Connector.ReadMemBlock ((unsigned*)dstImg8, dstAddr, size/4); //profiler_print2tbl("../../nm/sobel_mb7707_nmd.map", ReadMemBlock); printf("\n"); VS_SetData(2, dstImg8); VS_Text("%d clocks per frame, %.2f clocks per pixel, %.2f fps\r\n", t, 1.0*t/size, 320000000.0/t ); VS_Draw(VS_DRAW_ALL); } delete srcImg8; delete dstImg8; return 0; }
int main(void) { u8 num=0,w=0,res=0; delay_init(); //延时函数初始化 NVIC_Configuration(); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级 uart_init(9600); //串口初始化为9600 //LED_Init(); //LED端口初始化 //TPAD_Init(); //初始化触摸按键 //LCD_Init(); //LCD初始化 //KEY_Init(); //按键初始化 Audiosel_Init(); //初始化音源选择 //usmart_dev.init(72);//usmart初始化 mem_init(SRAMIN); //初始化内部内存池 VS_Init(); exfuns_init(); //为fatfs相关变量申请内存 f_mount(0,fs[0]); //挂载SD卡 f_mount(1,fs[1]); //挂载FLASH. POINT_COLOR=RED; while(1) { Audiosel_Set(0); //MP3通道 //LED1=0; //Show_Str(60,210,200,16,"存储器测试...",16,0); printf("存储器测试...\n"); VS_Ram_Test(); //Show_Str(60,210,200,16,"正弦波测试...",16,0); printf("正弦波测试...\n"); VS_Sine_Test(); //Show_Str(60,210,200,16,"<<WAV录音机>>",16,0); printf("<<WAV录音机>>\n"); //LED1=1; printf("输入a以进入音乐播放,输入b进入录音机\n"); while(1) { if(USART_RX_STA&0x8000) { num=USART_RX_STA&0x3fff; for(w=0;w<num;w++) { res=USART_RX_BUF[w]; } USART_RX_STA=0; switch(res) { case MUSIC:Mp3Play();break; case RECODER:RecoderPlay();break; case DELETE:DeleteRecorder();break; default: break; } printf("a:音乐\nb:录音机\nl:删除\n "); } } //RecoderPlay(); printf("竟然出错了。。。\n"); while(1); } }
u8 MP3_init(void) { //u32 bw, br; // FRESULT res; res = f_mount(&fs,"0:/",1); //挂载SD卡 if (res != FR_OK) { printf("mount failed!!!\r\n"); return 0; } else { printf("mount success!!!\r\n"); } #if 0 //写文件测试 printf("write file test......\n\r"); res = f_open(&fd, "0:/longfil.txt", FA_CREATE_ALWAYS | FA_WRITE); if(res != FR_OK){ printf("open file error : %d\n\r",res); }else{ res = f_write(&fd, textFileBuffer, sizeof(textFileBuffer), &bw); /* Write it to the dst file */ if(res == FR_OK){ printf("write data ok! %d\n\r",bw); }else{ printf("write data error : %d\n\r",res); } f_close(&fd); } //读文件测试 printf("read file test......\n\r"); res = f_open(&fd, "0:/test.txt", FA_OPEN_EXISTING | FA_READ); if(res != FR_OK){ printf("open file error : %d\n\r",res); }else{ res = f_read(&fd, buffer, sizeof(buffer), &br); /* Read a chunk of src file */ if(res==FR_OK){ printf("read data num : %d\n\r",br); printf("%s\n\r",buffer); }else{ printf("read file error : %d\n\r",res); } /*close file */ f_close(&fd); } #endif VS_Init(); //初始化VS1053 // KEY_Init(); //按键初始化 //扫描已经存在的文件 //printf("\n\rbegin scan files path......\n\r"); //scan_files(path); //SD_TotalSize(path);//获取SD容量 vsset.mvol=250; //默认设置音量为210. return 1; }