mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
110 lines
4.5 KiB
C
110 lines
4.5 KiB
C
/*********************************************************************************************************************
|
||
* 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 7725_UART
|
||
* @company <20>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD><EFBFBD>˾
|
||
* @author <20><><EFBFBD>ɿƼ<C9BF>(QQ3184284598)
|
||
* @version <20>鿴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
|
||
OV7725<32><35><EFBFBD>߶<EFBFBD><DFB6>壺
|
||
------------------------------------
|
||
ģ<><C4A3><EFBFBD>ܽ<EFBFBD> <09><>Ƭ<EFBFBD><C6AC><EFBFBD>ܽ<EFBFBD>
|
||
SDA(51<35><31>RX) <09>鿴SEEKFREE_7725_UART.h<>ļ<EFBFBD><C4BC>ڵ<EFBFBD>OV7725_COF_UART_TX <20>궨<EFBFBD><EAB6A8>
|
||
SCL(51<35><31>TX) <09>鿴SEEKFREE_7725_UART.h<>ļ<EFBFBD><C4BC>ڵ<EFBFBD>OV7725_COF_UART_RX <20>궨<EFBFBD><EAB6A8>
|
||
<20><><EFBFBD>ж<EFBFBD>(VSY) <09>鿴SEEKFREE_7725_UART.h<>ļ<EFBFBD><C4BC>ڵ<EFBFBD>OV7725_UART_VSYNC_PIN <20>궨<EFBFBD><EAB6A8>
|
||
<20><><EFBFBD>ж<EFBFBD>(HREF) δʹ<CEB4>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>
|
||
<20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(PCLK) <09>鿴SEEKFREE_7725_UART.h<>ļ<EFBFBD><C4BC>ڵ<EFBFBD>OV7725_UART_PCLK_PIN <20>궨<EFBFBD><EAB6A8>
|
||
<20><><EFBFBD>ݿ<EFBFBD>(D0-D7) <09>鿴SEEKFREE_7725_UART.h<>ļ<EFBFBD><C4BC>ڵ<EFBFBD>OV7725_UART_DATA_PIN <20>궨<EFBFBD><EAB6A8>
|
||
Ĭ<>Ϸֱ<CFB7><D6B1><EFBFBD> 160*120
|
||
Ĭ<><C4AC>FPS 50֡
|
||
------------------------------------
|
||
********************************************************************************************************************/
|
||
|
||
|
||
|
||
#ifndef _SEEKFREE_7725_UART_h
|
||
#define _SEEKFREE_7725_UART_h
|
||
|
||
|
||
#include "common.h"
|
||
#include "IfxDma_cfg.h"
|
||
#include "zf_uart.h"
|
||
|
||
|
||
#define OV7725_UART_W 160 //ֻ<><D6BB><EFBFBD><EFBFBD>80 160 240 320 <20><><EFBFBD>Ⱥ߶<CDB8><DFB6><EFBFBD><EFBFBD><EFBFBD>һһ<D2BB><D2BB>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ80<38><30><EFBFBD>߶<EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ60<36><30>
|
||
#define OV7725_UART_H 120 //ֻ<><D6BB><EFBFBD><EFBFBD>60 120 180 240
|
||
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
|
||
#define OV7725_UART_SIZE (OV7725_UART_W * OV7725_UART_H/8 ) //ͼ<><CDBC>ռ<EFBFBD>ÿռ<C3BF><D5BC><EFBFBD>С
|
||
#define OV7725_UART_DMA_NUM (OV7725_UART_SIZE ) //DMA<4D>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
|
||
//--------------------------------------------------------------------------------------------------
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
//--------------------------------------------------------------------------------------------------
|
||
#define OV7725_COF_UART UART_1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʹ<EFBFBD>õ<EFBFBD><C3B5>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||
#define OV7725_COF_UART_TX UART1_TX_P02_2
|
||
#define OV7725_COF_UART_RX UART1_RX_P02_3
|
||
|
||
#define OV7725_UART_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_UART_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_UART_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_UART_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
|
||
|
||
|
||
typedef enum
|
||
{
|
||
OV7725_INIT = 0x00, //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
OV7725_RESERVE, //<2F><><EFBFBD><EFBFBD>λ
|
||
OV7725_CONTRAST, //<2F>Աȶȵ<C8B6><C8B5><EFBFBD> ʵ<><CAB5><EFBFBD><EFBFBD>ֵ<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD>
|
||
OV7725_FPS, //֡<><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ֻ֧<D6BB><D6A7>50 75 100 112 150
|
||
OV7725_COL, //<2F>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ֻ<><D6BB><EFBFBD><EFBFBD>80 160 240 320
|
||
OV7725_ROW, //<2F>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ֻ<><D6BB><EFBFBD><EFBFBD>60 120 180 240
|
||
OV7725_CONFIG_FINISH, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ռλ<D5BC><CEBB><EFBFBD><EFBFBD>
|
||
|
||
OV7725_GET_WHO_AM_I= 0xEF,
|
||
OV7725_GET_STATUS = 0xF1,
|
||
OV7725_GET_VERSION = 0xF2,
|
||
|
||
OV7725_SET_ADDR = 0xFE,
|
||
OV7725_SET_DATA = 0xFF,
|
||
}OV7725_CMD;
|
||
|
||
extern uint8 ov7725_uart_image_bin[OV7725_UART_H][OV7725_UART_W/8]; //<2F><><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
extern uint8 ov7725_uart_image_dec[OV7725_UART_H][OV7725_UART_W]; //ͼ<><CDBC><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
extern uint8 ov7725_uart_finish_flag; //ͼ<><CDBC><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ɱ<EFBFBD>־λ
|
||
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
void ov7725_uart_callback(void);
|
||
void ov7725_uart_init(void);
|
||
void ov7725_uart_vsync(void);
|
||
void ov7725_uart_dma(void);
|
||
void image_decompression(uint8 *data1,uint8 *data2);
|
||
void seekfree_sendimg_7725(UARTN_enum uartn, uint8 *image, uint16 width, uint16 height);
|
||
|
||
|
||
#endif
|
||
|
||
|
||
|