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

116 lines
4.4 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 <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @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(51<35><31>RX) <09>鿴SEEKFREE_MT9V03X.h<>ļ<EFBFBD><C4BC>е<EFBFBD>MT9V03X_COF_UART_TX<54><EFBFBD><EAB6A8>
SCL(51<35><31>TX) <09>鿴SEEKFREE_MT9V03X.h<>ļ<EFBFBD><C4BC>е<EFBFBD>MT9V03X_COF_UART_RX<52><EFBFBD><EAB6A8>
<09><><EFBFBD>ж<EFBFBD>(VSY) <09>鿴SEEKFREE_MT9V03X.h<>ļ<EFBFBD><C4BC>е<EFBFBD>MT9V03X_VSYNC_PIN<49><EFBFBD><EAB6A8>
<09><><EFBFBD>ж<EFBFBD>(HREF) <09><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD>
<09><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(PCLK) <09>鿴SEEKFREE_MT9V03X.h<>ļ<EFBFBD><C4BC>е<EFBFBD>MT9V03X_PCLK_PIN<49><EFBFBD><EAB6A8>
<09><><EFBFBD>ݿ<EFBFBD>(D0-D7) <09>鿴SEEKFREE_MT9V03X.h<>ļ<EFBFBD><C4BC>е<EFBFBD>MT9V03X_DATA_PIN<49><EFBFBD><EAB6A8>
------------------------------------
Ĭ<>Ϸֱ<CFB7><D6B1><EFBFBD><EFBFBD><EFBFBD> 188*120
Ĭ<><C4AC>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><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 MT9V03X_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><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>
typedef enum
{
INIT = 0, //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
AUTO_EXP, //<2F>Զ<EFBFBD><D4B6>ع<EFBFBD><D8B9><EFBFBD><EFBFBD><EFBFBD>
EXP_TIME, //<2F>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><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