ov7670拍照时,将拍照框移动后,就再也存不到sd卡图片了
TIM6_Int_Init(10000,7199); //10Khz计数频率,1秒钟中断
EXTI8_Init(); //使能定时器捕获
OV7670_Window_Set(12,176,240 ,320); //设置窗口 12 176 LCD_Set_Window((lcddev.width-320)/16,lcddev.height-260
OV7670_CS=0;
LCD_Clear(RED);
r=lcddev.width;
t=lcddev.height;
printf("r=%d",r);
printf("t=%d",t);
while(1)
{
key=KEY_Scan(0);//不支持连按
if(key==KEY0_PRES)
{
if(sd_ok)
{
LED1=0; //点亮DS1,提示正在拍照
camera_new_pathname(pname);//得到文件名
if(bmp_encode(pname,(lcddev.width-320)/16,lcddev.height-260,240,320,0))//拍照有误
{
Show_Str(40,130,240,12,"写入文件错误!",12,0);
}else
{
Show_Str(40,130,240,12,"拍照成功!",12,0);
Show_Str(40,150,240,12,"保存为:",12,0);
Show_Str(40+42,150,240,12,pname,12,0);
BEEP=1; //蜂鸣器短叫,提示拍照完成
delay_ms(100);
}
}else //提示SD卡错误
{
Show_Str(40,130,240,12,"SD卡错误!",12,0);
Show_Str(40,150,240,12,"拍照功能不可用!",12,0);
}
BEEP=0;//关闭蜂鸣器
LED1=1;//关闭DS1
delay_ms(1800);//等待1.8秒钟
LCD_Clear(BLACK);
}else delay_ms(5);
camera_refresh();//更新显示
一周热门 更多>