2019-07-20 06:04发布
white_fox 发表于 2016-8-17 17:15 有一点应该有问题 你把数据DMA传输到内存buff中,为啥DCMI_DMA_Init()后面的内存地址设成了不增长啊
最多设置5个标签!
void rgb565_test(void)
{
//u16 i, j;
//u8 gm_red,gm_green,gm_blue;
//int gm_red,gm_green,gm_blue;
//u8 key;
//u8 effect=0,saturation=2,contrast=2;
//u8 scale=1; //ĬèÏêÇè«3ß′çËõ·Å
//u8 msgbuf[15]; //ÏûÏ¢»o′æÇø
LCD_Clear(WHITE);
POINT_COLOR=RED;
OV2640_RGB565_Mode(); //RGB565Ä£ê½
My_DCMI_Init(); //DCMIÅäÖÃ
DCMI_DMA_Init((int)&buffer,100,DMA_MemoryDataSize_HalfWord,DMA_MemoryInc_Disable);//DCMI DMAÅäÖÃ
OV2640_OutSize_Set(W,H);
DCMI_Start(); //Æô¶ˉ′«êä
}
帧中断
//DCMIÖD¶Ï·tÎñoˉêy
void DCMI_IRQHandler(void)
{
//if(frame_mode==0)
//{
if(DCMI_GetITStatus(DCMI_IT_FRAME)==SET)//2¶»ñμ½ò»Ö¡í¼Ïñ
{
jpeg_data_process(); //jpegêy¾Y′|àí
DCMI_ClearITPendingBit(DCMI_IT_FRAME);//Çå3yÖ¡ÖD¶Ï
LED1=!LED1;
//ov_frame++;
//frame_mode=1;
}
// }
}
jpeg数据处理
void jpeg_data_process(void) //????????,??????????????????????LCD?
{
int i,j;
if(ov2640_mode==0)//RGB565???
{
for(i=1;i<W;i++)
{
for(j=1;j<H;j++)
{
LCD_SetCursor(i,j);
LCD_WriteRAM_Prepare();
LCD->LCD_RAM=buffer[i][j];
}
}
// DCMI_ClearITPendingBit(DCMI_IT_FRAME);//Çå3yÖ¡ÖD¶Ï
}
}
dcmi启动传输
void DCMI_Start(void)
{
LCD_SetCursor(0,0);
LCD_WriteRAM_Prepare(); //¿aê¼D′èëGRAM
DMA_Cmd(DMA2_Stream1, ENABLE);//¿aÆôDMA2,Stream1
DCMI_CaptureCmd(ENABLE);//DCMI2¶»ñê1Äü
}
主函数
int main(void)
{
u8 key;
u8 t;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//éèÖÃÏμí3ÖD¶ÏóÅÏ輶·Ö×é2
delay_init(168); //3õê¼»ˉÑóê±oˉêy
uart_init(115200); //3õê¼»ˉ′®¿ú2¨ìØÂêÎa115200
usart2_init(42,115200); //3õê¼»ˉ′®¿ú22¨ìØÂêÎa115200
LED_Init(); //3õê¼»ˉLED
LCD_Init(); //LCD3õê¼»ˉ
KEY_Init(); //°′¼ü3õê¼»ˉ
TIM3_Int_Init(10000-1,8400-1);//10Khz¼Æêy,1ÃëÖóÖD¶Ïò»′Î
usmart_dev.init(84); //3õê¼»ˉUSMART
POINT_COLOR=RED;//éèÖÃ×ÖìåÎaoìé«
while(OV2640_Init())//3õê¼»ˉOV2640
{
LCD_ShowString(30,130,240,16,16,"OV2640 ERR");
delay_ms(200);
LCD_Fill(30,130,239,170,WHITE);
delay_ms(200);
}
LCD_ShowString(30,130,200,16,16,"OV2640 OK");
while(1)
{
key=KEY_Scan(0);
if(key==KEY0_PRES) //RGB565Ä£ê½
{
ov2640_mode=0;
break;
}else if(key==KEY1_PRES) //JPEGÄ£ê½
{
ov2640_mode=1;
break;
}
t++;
if(t==100)LCD_ShowString(30,150,230,16,16,"KEY0:RGB565 KEY1:JPEG"); //éá˸ÏÔê¾ìáê¾DÅÏ¢
if(t==200)
{
LCD_Fill(30,150,210,150+16,WHITE);
t=0;
}
delay_ms(5);
}
if(ov2640_mode==0)
//Identify();
rgb565_test();
}
改成了这个也不对的
DMA_MemoryInc_Enable
显示出来是全黑的
一周热门 更多>