/*---------------------------------------------------------------------------------------*/ void Camera_Test(void) { static uint8_t led_state = 0; /* 液晶初始化 */ //LCD_Init(); Key2_GPIO_Config(); GPIO_ResetBits(GPIOB, GPIO_Pin_1); // Lcd_GramScan( 2); /* ov7725 gpio 初始化 */ Ov7725_GPIO_Config(); /* ov7725 寄存器配置初始化 */ while(Ov7725_Init() != SUCCESS); /* ov7725 场信号线初始化 */ VSYNC_Init(); Ov7725_vsync = 0; while(1) { if(Key_Scan(GPIOC,GPIO_Pin_13,0) == KEY_ON) { if(led_state == 0) { GPIO_ResetBits(GPIOA, GPIO_Pin_8); led_state = 1; } else { GPIO_SetBits(GPIOA, GPIO_Pin_8); led_state = 0; } } if( Ov7725_vsync == 2 ) { FIFO_PREPARE; /*FIFO准备*/ ImagDisp(); /*采集并显示*/ Ov7725_vsync = 0; } } }
/* * ISO 自动整板测试 */ void ISO_AutoTest(void) { uint32_t i=0x10ffff; uint8_t board_state = 1; uint8_t board_test = 0x55; /* 液晶初始化先于串口,不然会有bug,至于是什么原因我也不知道:( */ LCD_Init(); USART1_Config(); /* 初始化sd卡文件系统,因为汉字的字库放在了sd卡里面 */ Sd_fs_init(); LCD_Clear(0,0,240,320,WHITE); LCD_DispStr(50,10,"ISO board auto test ",BLUE); USART1_Config(); SysTick_Init(); /* LED 端口初始化 */ LED_GPIO_Config(); LED1_ON; LED2_ON; LED3_ON; /*按键*/ Key1_GPIO_Config(); Key2_GPIO_Config(); /* EEPROM测试 */ LCD_DispEnCh(20,40,"1.EEPROM 自检中",BLUE); /*-----------------------------------------------------------------------------------*/ if (EEPROM_AutoTest() == 0) //坏 { board_state = 0; LCD_DispEnCh(20,40,"1.EEPROM 检测失败!",RED); } else { LCD_DispEnCh(20,40,"1.EEPROM 检测通过!",BLUE); } /* FLASH 测试 */ LCD_DispEnCh(20,70,"2.FLASH 自检中",BLUE); if(FLASH_AutoTest() == 0) //坏 { board_state = 0; LCD_DispEnCh(20,70,"2.FLASH 检测失败!",RED); } else { LCD_DispEnCh(20,70,"2.FLASH 检测通过!",BLUE); } /* RTC测试 */ LCD_DispEnCh(20,100,"3.RTC 自检中",BLUE); if(RTC_AutoTest() == 0) //坏 { board_state = 0; LCD_DispEnCh(20,100,"3.RTC 检测失败!",RED); } else { LCD_DispEnCh(20,100,"3.RTC 检测通过!",BLUE); } /* FM测试 */ LCD_DispEnCh(20,130,"4.FM 自检中",BLUE); if(RDA5807_FM_AutoTest() == 0) //坏 { board_state = 0; LCD_DispEnCh(20,130,"4.FM检测失败!",RED); } else { LCD_DispEnCh(20,130,"4.FM检测通过",BLUE); } /* mp3 sd 喇叭测试 */ /* 关闭systick定时器 以免影响mp3播放效果*/ SysTick->CTRL &= ~ SysTick_CTRL_ENABLE_Msk; LCD_DispEnCh(20,160,"5.MP3及喇叭自检中",BLUE); if(MP3_AutoTest() == 0) //坏 { board_state = 0; LCD_DispEnCh(20,160,"5.sd 卡错误!!! ",RED); } else { LCD_DispEnCh(20,160,"5.请确认喇叭是否有声音",BLUE); } if(board_state == 0)// 测试不通过 { LCD_DispEnCh(20,220,"自检测试不通过!!!",RED); while(1); } /* 按键测试 */ LCD_DispEnCh(20,190,"6.请检查按键及led灯 ",BLUE); while(i--) { /* 按键测试 */ if( Key_Scan(GPIOA,GPIO_Pin_0) == KEY_ON) { key_state =~key_state; LED1_TOGGLE; LED2_TOGGLE; LED3_TOGGLE; } if( Key_Scan(GPIOC,GPIO_Pin_13)== KEY_ON) { key_state =~key_state; LED1_TOGGLE; LED2_TOGGLE; LED3_TOGGLE; } } ee_WriteBytes(&board_test,0,1); //自测成功,写入标记 Soft_Reset(); }