代码是移植的原子哥的
[mw_shl_code=c,true]int main(void)
{
System_Init();
LED_Init();
Button_Init();
USART_Config(115200);
LED_On(LED_Red|LED_Green);
OV2640_Init();
DCMI_DMA_Init((u32)JPEG_Buff0
,JPEGBuffSize,DMA_MemoryDataSize_Word,DMA_MemoryInc_Enable);
printf("InitOK
");
jpeg_test();
}
void jpeg_test(void)
{
u32 i;
u8 *p;
OV2640_JPEG_Mode();
OV2640_OutSize_Set(320,240);
DCMI_Start();
while(1)
{
if(jpeg_data_ok==1) /
{
p=(u8*)JPEG_Buff0;
for(i=0;i<jpeg_data_len*4;i++)
{
while(USART_GetFlagStatus(USART2,USART_FLAG_TC)==RESET);
USART_SendData(USART1,p);
}
}
jpeg_data_ok=2;
}
} [/mw_shl_code]
[mw_shl_code=c,true]void jpeg_data_process(void)
{
if(jpeg_data_ok==0)
{
DMA_Cmd(DMA2_Stream1, DISABLE);
while (DMA_GetCmdStatus(DMA2_Stream1) != DISABLE){}
jpeg_data_len=JPEGBuffSize-DMA_GetCurrDataCounter(DMA2_Stream1);
jpeg_data_ok=1;
}
if(jpeg_data_ok==2)
{
DMA2_Stream1->NDTR=JPEGBuffSize;
DMA_SetCurrDataCounter(DMA2_Stream1,JPEGBuffSize);
DMA_Cmd(DMA2_Stream1, ENABLE);
jpeg_data_ok=0;
}
}
void DCMI_IRQHandler(void)
{
if(DCMI_GetITStatus(DCMI_IT_FRAME)==SET)
{
jpeg_data_process();
DCMI_ClearITPendingBit(DCMI_IT_FRAME);
LED_Toggle(LED_Red);
}
} [/mw_shl_code]
摄像头ID能都出来 串口没有数据传出来 仿真看了 缓存里面是有数据而且一直是在变的
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>