標(biāo)題:
STM32 Camera二維碼識別源碼
[打印本頁]
作者:
qq854372571
時間:
2017-11-30 22:06
標(biāo)題:
STM32 Camera二維碼識別源碼
可以進(jìn)來看看?下面有我自己的例程下載。
單片機(jī)源程序如下:
/**
* @file main.c
* @author WB R&D Team - openmcu666
* @version V0.1
* @date 2016.08.24
* @brief Main Program body
*/
#include "stm32f4xx.h"
#include "Gpio.h"
#include "usart.h"
#include "delay.h"
#include "stm32f429i_lcd.h"
#include "ov7670.h"
#include "ov2640.h"
#include "ov5642.h"
#include "mt9d111.h"
#include "CamConfig.h"
#include "sccb_bus.h"
#include "RTC.h"
#include "string.h"
#include "QR_Decoder.h"
//only for OV5642
/*****************************************************************************
** Main Function main()
******************************************************************************/
int main(void)
{
uint16_t temper;
char qr_type_len=0;
short qr_data_len=0;
char qr_type_buf[10];
char qr_data_buf[512];
int addr=0;
int i=0,j=0;
char qr_num=0;
USART1_Init();
//LED_Init();
Key_Init();
BEEP_Init();
printf("\r\n");
printf("Hello Welcome.\r\n");
printf("Thank You For Choosing Our Products.\r\n");
printf("Thank You Very Much.\r\n");
printf("This Example Camera.\r\n");
printf("\r\n");
printf("DCMI Initialization...\r\n");
LCD_Init();
LCD_LayerInit();
LTDC_Cmd(ENABLE);
LCD_SetLayer(LCD_BACKGROUND_LAYER);
LCD_SetTransparency(0xFF);
LCD_Clear(BLACK);
LCD_SetLayer(LCD_FOREGROUND_LAYER); //使用前景層
LCD_SetTransparency(0xFF); //設(shè)置透明度
LCD_Clear_ARGB8888(0x40000000);
LCD_SetTextColor_ARGB8888(0xFFFFFFFF);
LCD_DrawFullRect_ARGB8888(Frame_Width,Frame_Width); //繪制透明框
LCD_DrawBox_ARGB8888(Frame_Width,Frame_Line_Length,Frame_Line_Size,0xD05CBDE7); //繪制掃描框
printf("Ok,Let's Go...\r\n");
temper = ov7670_check(); //Camera是否為OV7670
if (temper == 0x7673)
{
printf("Cam ID : [0x%02x]\r\n",temper);
if (ov7670_init())
{
printf("Init OV7670 reg Fail...\r\n");
while (1)
{
}
}
else
{
printf("Init OV7670 reg OK...\r\n");
printf("Show Camer Data...\r\n");
}
}
else
{
temper=ov2640_check();
if(temper==0x2642) //OV2640
{
if (ov2640_init())
{
printf("Init OV2640 reg Fail...\r\n");
while (1)
{}
}
else
{
printf("Cam ID : [0x%02x]\r\n",temper);
printf("Init OV2640 reg OK...\r\n");
printf("Show Camer Data...\r\n");
}
}
else //ov5642 or mt9d111
{
temper=ov5642_check();
printf("Cam ID : [0x%02x]\r\n",temper);
if (temper==0x5642)//mt9d111_init
{
ov5642_init();
printf("Init ov5642 reg OK...\r\n");
printf("Show Camer Data...\r\n");
}
else
{
printf("Init ov5642 reg Fail...\r\n");
while (1){}
}
}
}
// if(RTC_Config()) //初始化RTC
// {
// printf("\r\nLSE start failed\r\n");
// }
// RTC_Set_WakeUp(RTC_WakeUpClock_CK_SPRE_16bits,0); //配置WAKE UP中斷,1秒鐘中斷一次,用于統(tǒng)計幀率
systick_delay_ms(100);
ov5642_auto_focus();
cam_start();
while (1)
{
qr_num = QR_decoder();
if(qr_num)
{
GPIO_SetBits(BEEP_GPIO_PORT,BEEP_GPIO_PIN);
systick_delay_ms(100);
GPIO_ResetBits(BEEP_GPIO_PORT,BEEP_GPIO_PIN);
//解碼的數(shù)據(jù)是按照識別條碼的個數(shù)封裝好的二維數(shù)組,這些數(shù)據(jù)需要
//根據(jù)識別條碼的個數(shù),按組解包并通過串口發(fā)送到上位機(jī)串口終端
for(i=0;i < qr_num;i++)
{
qr_type_len = decoded_buf[i][addr++];//獲取解碼類型長度
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
【02】紅龍429_Camera二維碼識別().rar
(1.15 MB, 下載次數(shù): 62)
2017-12-1 04:12 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
shanji
時間:
2017-12-5 11:12
這可是旺寶電子的代碼。你是旺寶電子的?
作者:
流穿
時間:
2018-4-1 19:29
可不可以用到51單片機(jī)里
作者:
mcgradytttt
時間:
2018-4-2 14:50
非常感謝 支持啊 多謝樓主
作者:
fzfrd
時間:
2018-8-18 00:25
好東西下載學(xué)習(xí)下
作者:
fzfrd
時間:
2018-8-18 00:25
不錯,學(xué)習(xí)了
作者:
MiloDai
時間:
2019-7-23 11:01
很好,正好可以學(xué)習(xí)如何用STM32 來實(shí)現(xiàn)二維碼掃描,謝謝
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1