📄 test_csi.c
字号:
#include "SystemHeader.h"
#include "./CSI/CSI.h"
#include "./OV7720/OV7720.h"
short Test_CSI(void)
{
int i, j;
short x, y;
short Ret = 0;
TFT_SetBGColor(0x0001);
TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
TFT_SetBGColor(COLOR_WHITE);
TFT_SetWindow(40, 40, 279, 199);
TFT_SetColor(COLOR_RED);
TFT_Rectangle(0, 0, 239, 159, PAINT_HOLLOW);
TFT_SetColor(COLOR_BLUE);
TFT_SetWindow(42, 42, 277, 197);
TFT_SetTextPos(0, 0);
TFT_Print("马上开始测试摄像头, 请确定摄像头已经插在SENSOR接口上, 点击屏幕任意位置开始测试...");
for(;;)
{
Touch_Get(&x, &y);
if(x!=-1) break;
}
for(;;)
{
Touch_Get(&x, &y);
if(x==-1) break;
}
// for(j = 0; i < 0x1000; j++)
// for(i=0; i<1000000; i++)
// asm("nop");
CSI_Init(TFT_BUFFER0_SA, TFT_BUFFER1_SA, TFT_BUFFER2_SA); // CSI初始化
CSI_Ctrl_Set(QVGA, YUVIN, 30); // OV VGA设置
Ret = Ov7720_Init(QVGA, YUVIN, 30); // OV7720初始化
if(Ret)
{
CSI_Cut(1, 0, 0, 320 / 16, (240 - 16) / 16);
TFT_SetBGColor(0x0001);
TFT_SetWindow(0, 240 - 16, 320, 240);
TFT_SetTextPos((320 - 24 * 8) / 2, 0);
TFT_Print("点击屏幕任意位置退出测试");
while(1)
{
Touch_Get(&x, &y);
if(x!=-1) break;
}
CSI_UnInit();
}
else
{
TFT_SetWindow(40, 40, 279, 199);
TFT_SetTextPos(25, 30);
TFT_SetColor(COLOR_RED);
TFT_Print("摄像头测试失败!");
TFT_SetTextPos(15, 70);
TFT_Print("点击屏幕的任意位置返回");
for(j = 0; i < 0x100; j++)
for(i=0; i<1000000; i++);
while(1)
{
Touch_Get(&x, &y);
if(x!=-1) break;
}
CSI_UnInit();
}
TFT_SetBGColor(0x0001);
TFT_SetWindow(0, 0, TFT_WIDTH-1, TFT_HEIGHT-1);
return Ret;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -