2022-01-18 00:58:54 +08:00

241 lines
8.8 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*********************************************************************************************************************
* COPYRIGHT NOTICE
* Copyright (c) 2020,<2C><><EFBFBD>ɿƼ<C9BF>
* All rights reserved.
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQȺ<51><C8BA><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA>824575535
*
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD>У<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>;<EFBFBD><CDBE>
* <20><>ӭ<EFBFBD><D3AD>λʹ<CEBB>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC>İ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @file main
* @company <09>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
* @author <09><><EFBFBD>ɿƼ<C9BF>(QQ3184284598)
* @version <09>鿴doc<6F><63>version<6F>ļ<EFBFBD> <20>汾˵<E6B1BE><CBB5>
* @Software ADS v1.2.2
* @Target core TC264D
* @Taobao https://seekfree.taobao.com/
* @date 2020-3-23
* @note
<09><><EFBFBD>߶<EFBFBD><DFB6>
------------------------------------
ģ<><C4A3><EFBFBD>ܽ<EFBFBD> <09><>Ƭ<EFBFBD><C6AC><EFBFBD>ܽ<EFBFBD>
SDA <20>鿴SEEKFREE_IIC<49>ļ<EFBFBD><C4BC>ڵ<EFBFBD>SEEKFREE_SDA<44><EFBFBD><EAB6A8>
SCL <20>鿴SEEKFREE_IIC<49>ļ<EFBFBD><C4BC>ڵ<EFBFBD>SEEKFREE_SCL<43><EFBFBD><EAB6A8>
<09><><EFBFBD>ж<EFBFBD>(VSY) <20>鿴SEEKFREE_OV7725.h<>ļ<EFBFBD><C4BC>е<EFBFBD>OV7725_VSYNC_PIN<49><EFBFBD><EAB6A8>
<09><><EFBFBD>ж<EFBFBD>(HREF) δʹ<CEB4>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>
<09><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(PCLK) <20>鿴SEEKFREE_OV7725.h<>ļ<EFBFBD><C4BC>е<EFBFBD>OV7725_PCLK_PIN<49><EFBFBD><EAB6A8>
<09><><EFBFBD>ݿ<EFBFBD>(D0-D7) <20>鿴SEEKFREE_OV7725.h<>ļ<EFBFBD><C4BC>е<EFBFBD>OV7725_DATA_PIN<49><EFBFBD><EAB6A8>
------------------------------------
Ĭ<>Ϸֱ<CFB7><D6B1><EFBFBD><EFBFBD><EFBFBD> 160*120
Ĭ<><C4AC>FPS 50֡
********************************************************************************************************************/
#ifndef _SEEKFREE_7725_h
#define _SEEKFREE_7725_h
#include "common.h"
#include "IfxDma_cfg.h"
#include "zf_uart.h"
//<2F><><EFBFBD><EFBFBD>ͷID<49><44>
#define OV7725_ID 0x21
//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
#define OV7725_GAIN 0x00
#define OV7725_BLUE 0x01
#define OV7725_RED 0x02
#define OV7725_GREEN 0x03
#define OV7725_BAVG 0x05
#define OV7725_GAVG 0x06
#define OV7725_RAVG 0x07
#define OV7725_AECH 0x08
#define OV7725_COM2 0x09
#define OV7725_PID 0x0A
#define OV7725_VER 0x0B
#define OV7725_COM3 0x0C
#define OV7725_COM4 0x0D
#define OV7725_COM5 0x0E
#define OV7725_COM6 0x0F
#define OV7725_AEC 0x10
#define OV7725_CLKRC 0x11
#define OV7725_COM7 0x12
#define OV7725_COM8 0x13
#define OV7725_COM9 0x14
#define OV7725_COM10 0x15
#define OV7725_REG16 0x16
#define OV7725_HSTART 0x17
#define OV7725_HSIZE 0x18
#define OV7725_VSTRT 0x19
#define OV7725_VSIZE 0x1A
#define OV7725_PSHFT 0x1B
#define OV7725_MIDH 0x1C
#define OV7725_MIDL 0x1D
#define OV7725_LAEC 0x1F
#define OV7725_COM11 0x20
#define OV7725_BDBase 0x22
#define OV7725_BDMStep 0x23
#define OV7725_AEW 0x24
#define OV7725_AEB 0x25
#define OV7725_VPT 0x26
#define OV7725_REG28 0x28
#define OV7725_HOutSize 0x29
#define OV7725_EXHCH 0x2A
#define OV7725_EXHCL 0x2B
#define OV7725_VOutSize 0x2C
#define OV7725_ADVFL 0x2D
#define OV7725_ADVFH 0x2E
#define OV7725_YAVE 0x2F
#define OV7725_LumHTh 0x30
#define OV7725_LumLTh 0x31
#define OV7725_HREF 0x32
#define OV7725_DM_LNL 0x33
#define OV7725_DM_LNH 0x34
#define OV7725_ADoff_B 0x35
#define OV7725_ADoff_R 0x36
#define OV7725_ADoff_Gb 0x37
#define OV7725_ADoff_Gr 0x38
#define OV7725_Off_B 0x39
#define OV7725_Off_R 0x3A
#define OV7725_Off_Gb 0x3B
#define OV7725_Off_Gr 0x3C
#define OV7725_COM12 0x3D
#define OV7725_COM13 0x3E
#define OV7725_COM14 0x3F
#define OV7725_COM16 0x41
#define OV7725_TGT_B 0x42
#define OV7725_TGT_R 0x43
#define OV7725_TGT_Gb 0x44
#define OV7725_TGT_Gr 0x45
#define OV7725_LC_CTR 0x46
#define OV7725_LC_XC 0x47
#define OV7725_LC_YC 0x48
#define OV7725_LC_COEF 0x49
#define OV7725_LC_RADI 0x4A
#define OV7725_LC_COEFB 0x4B
#define OV7725_LC_COEFR 0x4C
#define OV7725_FixGain 0x4D
#define OV7725_AREF1 0x4F
#define OV7725_AREF6 0x54
#define OV7725_UFix 0x60
#define OV7725_VFix 0x61
#define OV7725_AWBb_blk 0x62
#define OV7725_AWB_Ctrl0 0x63
#define OV7725_DSP_Ctrl1 0x64
#define OV7725_DSP_Ctrl2 0x65
#define OV7725_DSP_Ctrl3 0x66
#define OV7725_DSP_Ctrl4 0x67
#define OV7725_AWB_bias 0x68
#define OV7725_AWBCtrl1 0x69
#define OV7725_AWBCtrl2 0x6A
#define OV7725_AWBCtrl3 0x6B
#define OV7725_AWBCtrl4 0x6C
#define OV7725_AWBCtrl5 0x6D
#define OV7725_AWBCtrl6 0x6E
#define OV7725_AWBCtrl7 0x6F
#define OV7725_AWBCtrl8 0x70
#define OV7725_AWBCtrl9 0x71
#define OV7725_AWBCtrl10 0x72
#define OV7725_AWBCtrl11 0x73
#define OV7725_AWBCtrl12 0x74
#define OV7725_AWBCtrl13 0x75
#define OV7725_AWBCtrl14 0x76
#define OV7725_AWBCtrl15 0x77
#define OV7725_AWBCtrl16 0x78
#define OV7725_AWBCtrl17 0x79
#define OV7725_AWBCtrl18 0x7A
#define OV7725_AWBCtrl19 0x7B
#define OV7725_AWBCtrl20 0x7C
#define OV7725_AWBCtrl21 0x7D
#define OV7725_GAM1 0x7E
#define OV7725_GAM2 0x7F
#define OV7725_GAM3 0x80
#define OV7725_GAM4 0x81
#define OV7725_GAM5 0x82
#define OV7725_GAM6 0x83
#define OV7725_GAM7 0x84
#define OV7725_GAM8 0x85
#define OV7725_GAM9 0x86
#define OV7725_GAM10 0x87
#define OV7725_GAM11 0x88
#define OV7725_GAM12 0x89
#define OV7725_GAM13 0x8A
#define OV7725_GAM14 0x8B
#define OV7725_GAM15 0x8C
#define OV7725_SLOP 0x8D
#define OV7725_DNSTh 0x8E
#define OV7725_EDGE0 0x8F
#define OV7725_EDGE1 0x90
#define OV7725_DNSOff 0x91
#define OV7725_EDGE2 0x92
#define OV7725_EDGE3 0x93
#define OV7725_MTX1 0x94
#define OV7725_MTX2 0x95
#define OV7725_MTX3 0x96
#define OV7725_MTX4 0x97
#define OV7725_MTX5 0x98
#define OV7725_MTX6 0x99
#define OV7725_MTX_Ctrl 0x9A
#define OV7725_BRIGHT 0x9B
#define OV7725_CNST 0x9C
#define OV7725_UVADJ0 0x9E
#define OV7725_UVADJ1 0x9F
#define OV7725_SCAL0 0xA0
#define OV7725_SCAL1 0xA1
#define OV7725_SCAL2 0xA2
#define OV7725_SDE 0xA6
#define OV7725_USAT 0xA7
#define OV7725_VSAT 0xA8
#define OV7725_HUECOS 0xA9
#define OV7725_HUESIN 0xAA
#define OV7725_SIGN 0xAB
#define OV7725_DSPAuto 0xAC
#define OV7725_DEV_ADD 0x42>>1
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
#define OV7725_W 160 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷͼ<CDB7><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <09><><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD> 80 160 240 320
#define OV7725_H 120 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷͼ<CDB7><CDBC><EFBFBD>߶<EFBFBD> <09><><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD> 60 120 180 240
#define OV7725_SIZE (OV7725_W * OV7725_H/8 ) //ͼ<><CDBC>ռ<EFBFBD>ÿռ<C3BF><D5BC><EFBFBD>С
#define OV7725_DMA_NUM (OV7725_SIZE) //һ<><D2BB>ͼ<EFBFBD><CDBC>DMA<4D>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>
//--------------------------------------------------------------------------------------------------
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//--------------------------------------------------------------------------------------------------
#define OV7725_VSYNC_PIN ERU_CH3_REQ6_P02_0 //<2F><><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD> <09><>ѡ<EFBFBD><D1A1>Χ<EFBFBD>ο<EFBFBD>ERU_PIN_enumö<6D><C3B6> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>Ϊͬһ<CDAC><D2BB>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǹ<EFBFBD><C7B9><EFBFBD><EFBFBD>жϵ<D0B6>ͨ<EFBFBD><CDA8>
//<2F><><EFBFBD><EFBFBD>ж<EFBFBD>ѡ<EFBFBD><D1A1>ERU_CH3 <20><>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>žͲ<C5BE><CDB2><EFBFBD>ѡ<EFBFBD><D1A1>ERU_CH7<48><37><EFBFBD><EFBFBD>Ϊ3<CEAA><33>7<EFBFBD><37><EFBFBD>ж<EFBFBD><D0B6>ǹ<EFBFBD><C7B9>õġ<C3B5>
#define OV7725_DATA_PIN P00_0 //<2F><><EFBFBD><EFBFBD>D0<44><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>D0<44><30><EFBFBD><EFBFBD>ΪP00_0 <20><>ôD1<44><31>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪP00_1<5F><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>P00_0<5F><30>P02_0<5F><30>P15_0<5F><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define OV7725_PCLK_PIN ERU_CH2_REQ14_P02_1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ѡ<EFBFBD><D1A1>Χ<EFBFBD>ο<EFBFBD>ERU_PIN_enumö<6D><C3B6> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>Ϊͬһ<CDAC><D2BB>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǹ<EFBFBD><C7B9><EFBFBD><EFBFBD>жϵ<D0B6>ͨ<EFBFBD><CDA8>
//<2F><><EFBFBD><EFBFBD>ж<EFBFBD>ѡ<EFBFBD><D1A1>ERU_CH3 <20><>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>žͲ<C5BE><CDB2><EFBFBD>ѡ<EFBFBD><D1A1>ERU_CH7<48><37><EFBFBD><EFBFBD>Ϊ3<CEAA><33>7<EFBFBD><37><EFBFBD>ж<EFBFBD><D0B6>ǹ<EFBFBD><C7B9>õġ<C3B5>
#define OV7725_DMA_CH IfxDma_ChannelId_5 //<2F><><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>DMAͨ<41><CDA8> 0-47<34><37>ѡ ͨ<><CDA8><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>Խ<EFBFBD><D4BD>
//<2F>޸Ĵ˴<C4B4>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>޸Ķ<DEB8>Ӧ<EFBFBD><D3A6>ERU<52>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><CBB4><EFBFBD><EFBFBD><EFBFBD>ΪIfxDma_ChannelId_5<5F><35><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ERU<52>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ȼ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ5
extern uint8 image_bin[OV7725_H][OV7725_W/8]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6B4A2><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
extern uint8 image_dec[OV7725_H][OV7725_W]; //ͼ<><CDBC><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
extern uint8 ov7725_finish_flag; //ͼ<><CDBC><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɱ<EFBFBD>־λ
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8 ov7725_init(void);
void ov7725_vsync(void);
void ov7725_dma(void);
#endif