|
可以進(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)計(jì)幀率
- 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í)別條碼的個(gè)數(shù)封裝好的二維數(shù)組,這些數(shù)據(jù)需要
- //根據(jù)識(shí)別條碼的個(gè)數(shù),按組解包并通過串口發(fā)送到上位機(jī)串口終端
- for(i=0;i < qr_num;i++)
- {
- qr_type_len = decoded_buf[i][addr++];//獲取解碼類型長度
-
- ……………………
- …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
【02】紅龍429_Camera二維碼識(shí)別().rar
(1.15 MB, 下載次數(shù): 62)
2017-12-1 04:12 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
|