初级会员

- 积分
- 92
- 金钱
- 92
- 注册时间
- 2016-6-25
- 在线时间
- 21 小时
|
发表于 2017-3-20 14:19:43
|
显示全部楼层
改成这样是最好的,刚才那个会影响后面一位的数据。
[mw_shl_code=c,true]//摄像头数据DMA接收完成中断回调函数
void qr_dcmi_rx_callback(void)
{
u32 *pbuf;
u16 i,high,low;
pbuf=(u32*)(rgb_data_buf+dcmi_curline*qr_image_width);//将rgb_data_buf地址偏移赋值给pbuf
if(DMA2_Stream1->CR&(1<<19))//DMA使用buf1,读取buf0
{
for(i=0;i<qr_image_width/2;i++)
{
high=(u16)dcmi_line_buf[0]>>16;
low=(u16)dcmi_line_buf[0];
if(high<36728)high=0;else high=65535;
if(low<36728)low=0;else low=65535;
dcmi_line_buf[0]=(u32)high<<16|low;
pbuf=dcmi_line_buf[0];
}
}else //DMA使用buf0,读取buf1
{
for(i=0;i<qr_image_width/2;i++)
{
high=(u16)dcmi_line_buf[1]>>16;
low=(u16)dcmi_line_buf[1];
if(high<36728)high=0;else high=65535;
if(low<36728)low=0;else low=65535;
dcmi_line_buf[1]=(u32)high<<16|low;
pbuf=dcmi_line_buf[1];
}
}
dcmi_curline++;
}[/mw_shl_code] |
|