116 lines
4.4 KiB
C
Raw Normal View History

2022-01-18 00:58:54 +08:00
/*********************************************************************************************************************
* COPYRIGHT NOTICE
* Copyright (c) 2020,<EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD>
* All rights reserved.
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQȺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><EFBFBD>824575535
*
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>;<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD>λʹ<EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD>İ<EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @file <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @company <EFBFBD>ɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾
* @author <EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD>(QQ3184284598)
* @version <EFBFBD>doc<EFBFBD><EFBFBD>version<EFBFBD>ļ<EFBFBD> <EFBFBD>˵<EFBFBD><EFBFBD>
* @Software ADS v1.2.2
* @Target core TC264D
* @Taobao https://seekfree.taobao.com/
* @date 2020-3-23
* @note
<EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><EFBFBD>
------------------------------------
ģ<EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD> <EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD>
SDA(51<EFBFBD><EFBFBD>RX) <EFBFBD>SEEKFREE_MT9V03X.h<EFBFBD>ļ<EFBFBD><EFBFBD>е<EFBFBD>MT9V03X_COF_UART_TX<EFBFBD><EFBFBD><EFBFBD>
SCL(51<EFBFBD><EFBFBD>TX) <EFBFBD>SEEKFREE_MT9V03X.h<EFBFBD>ļ<EFBFBD><EFBFBD>е<EFBFBD>MT9V03X_COF_UART_RX<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(VSY) <EFBFBD>SEEKFREE_MT9V03X.h<EFBFBD>ļ<EFBFBD><EFBFBD>е<EFBFBD>MT9V03X_VSYNC_PIN<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(HREF) <EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(PCLK) <EFBFBD>SEEKFREE_MT9V03X.h<EFBFBD>ļ<EFBFBD><EFBFBD>е<EFBFBD>MT9V03X_PCLK_PIN<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>(D0-D7) <EFBFBD>SEEKFREE_MT9V03X.h<EFBFBD>ļ<EFBFBD><EFBFBD>е<EFBFBD>MT9V03X_DATA_PIN<EFBFBD><EFBFBD><EFBFBD>
------------------------------------
Ĭ<EFBFBD>Ϸֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 188*120
Ĭ<EFBFBD><EFBFBD>FPS 50֡
********************************************************************************************************************/
#ifndef _SEEKFREE_MT9V03X_h
#define _SEEKFREE_MT9V03X_h
#include "common.h"
#include "IfxDma_cfg.h"
#include "zf_uart.h"
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
#define MT9V03X_W 188 //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <09><>Χ1-188
#define MT9V03X_H 120 //ͼ<><CDBC><EFBFBD>߶<EFBFBD> <09><>Χ1-120
//--------------------------------------------------------------------------------------------------
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//--------------------------------------------------------------------------------------------------
#define MT9V03X_COF_UART UART_1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD>õ<EFBFBD><C3B5>Ĵ<EFBFBD><C4B4><EFBFBD>
#define MT9V03X_COF_UART_TX UART1_TX_P02_2
#define MT9V03X_COF_UART_RX UART1_RX_P02_3
#define MT9V03X_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 MT9V03X_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 MT9V03X_PCLK_PIN ERU_CH2_REQ14_P02_1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD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FBD><EFBFBD><EFBFBD><EFBFBD>
FPS, //<2F><><EFBFBD><EFBFBD>ͷ֡<CDB7><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET_COL, //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET_ROW, //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LR_OFFSET, //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UD_OFFSET, //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GAIN, //ͼ<><CDBC>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CONFIG_FINISH, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ռλ<D5BC><CEBB><EFBFBD><EFBFBD>
COLOR_GET_WHO_AM_I = 0xEF,
SET_EXP_TIME = 0XF0, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GET_STATUS, //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GET_VERSION, //<2F>̼<EFBFBD><CCBC><EFBFBD><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET_ADDR = 0XFE, //<2F>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
SET_DATA //<2F>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}CMD;
extern uint8 receive[3]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʱ<CFA2><CAB1><EFBFBD><EFBFBD> <20><>ֹ<EFBFBD>û<EFBFBD>ʹ<EFBFBD>øñ<C3B8><C3B1><EFBFBD>
extern uint8 receive_num; //<2F><><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʱ<CFA2><CAB1><EFBFBD><EFBFBD> <20><>ֹ<EFBFBD>û<EFBFBD>ʹ<EFBFBD>øñ<C3B8><C3B1><EFBFBD>
extern vuint8 uart_receive_flag; //<2F><><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʱ<CFA2><CAB1><EFBFBD><EFBFBD> <20><>ֹ<EFBFBD>û<EFBFBD>ʹ<EFBFBD>øñ<C3B8><C3B1><EFBFBD>
extern uint8 mt9v03x_finish_flag;//һ<><D2BB>ͼ<EFBFBD><CDBC><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɱ<EFBFBD>־λ
extern uint8 mt9v03x_image[MT9V03X_H][MT9V03X_W];
void mt9v03x_uart_callback(void);
void set_config(UARTN_enum uartn, int16 buff[CONFIG_FINISH-1][2]);
void get_config(UARTN_enum uartn, int16 buff[CONFIG_FINISH-1][2]);
uint16 get_version(UARTN_enum uartn);
uint16 set_exposure_time(UARTN_enum uartn, uint16 light);
void mt9v03x_init(void);
void mt9v03x_vsync(void);
void mt9v03x_dma(void);
void seekfree_sendimg_03x(UARTN_enum uartn, uint8 *image, uint16 width, uint16 height);
void seekfree_sendimg_03x_usb_cdc(uint8 *image, uint16 width, uint16 height);
#endif