342 lines
12 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 7725_UART
* @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
OV7725<EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><EFBFBD>
------------------------------------
ģ<EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD> <EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD>
SDA(51<EFBFBD><EFBFBD>RX) <EFBFBD>SEEKFREE_7725_UART.h<EFBFBD>ļ<EFBFBD><EFBFBD>ڵ<EFBFBD>OV7725_COF_UART_TX <EFBFBD><EFBFBD><EFBFBD>
SCL(51<EFBFBD><EFBFBD>TX) <EFBFBD>SEEKFREE_7725_UART.h<EFBFBD>ļ<EFBFBD><EFBFBD>ڵ<EFBFBD>OV7725_COF_UART_RX <EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(VSY) <EFBFBD>SEEKFREE_7725_UART.h<EFBFBD>ļ<EFBFBD><EFBFBD>ڵ<EFBFBD>OV7725_UART_VSYNC_PIN <EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(HREF) δʹ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>(PCLK) <EFBFBD>SEEKFREE_7725_UART.h<EFBFBD>ļ<EFBFBD><EFBFBD>ڵ<EFBFBD>OV7725_UART_PCLK_PIN <EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>(D0-D7) <EFBFBD>SEEKFREE_7725_UART.h<EFBFBD>ļ<EFBFBD><EFBFBD>ڵ<EFBFBD>OV7725_UART_DATA_PIN <EFBFBD><EFBFBD><EFBFBD>
Ĭ<EFBFBD>Ϸֱ<EFBFBD><EFBFBD><EFBFBD> 160*120
Ĭ<EFBFBD><EFBFBD>FPS 50֡
------------------------------------
********************************************************************************************************************/
#include "IfxDma.h"
#include "IfxScuEru.h"
#include "zf_stm_systick.h"
#include "zf_gpio.h"
#include "zf_eru.h"
#include "zf_eru_dma.h"
#include "SEEKFREE_7725_UART.h"
IFX_ALIGN(4) 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>
uint8 ov7725_uart_image_dec[OV7725_UART_H][OV7725_UART_W];
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint16 OV7725_CFG[OV7725_CONFIG_FINISH][2]=
{
{OV7725_RESERVE, 0},
{OV7725_CONTRAST, 0x30}, //<2F>Աȶ<D4B1>0x00-0xff(<28>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>ֵ <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>ֵ<EFBFBD>޸ĵ<DEB8>Ч<EFBFBD><D0A7>)
{OV7725_FPS, 50}, //֡<><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ֻ֧<D6BB><D6A7>50 75 100 112 150
{OV7725_COL, OV7725_UART_W}, //ֻ<><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>
{OV7725_ROW, OV7725_UART_H}, //ֻ<><D6BB><EFBFBD><EFBFBD>60 120 180 240
{OV7725_INIT, 0} //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʼ<EFBFBD><CABC>ʼ<EFBFBD><CABC>
};
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint16 OV7725_GET_CFG[OV7725_CONFIG_FINISH-1][2]=
{
{OV7725_RESERVE, 0},
{OV7725_CONTRAST, 0},
{OV7725_FPS, 0},
{OV7725_COL, 0},
{OV7725_ROW, 0}
};
uint8 ov7725_uart_receive[3];
uint8 ov7725_uart_receive_num = 0;
uint8 ov7725_uart_receive_flag = 0;
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>жϺ<D0B6><CFBA><EFBFBD>
// @param NULL
// @return void
// @since v1.0
// Sample usage:
// @note <20>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD>ISR<53>ļ<EFBFBD> <20><><EFBFBD><EFBFBD>3<EFBFBD>жϳ<D0B6><CFB3>򱻵<EFBFBD><F2B1BBB5><EFBFBD>
//-------------------------------------------------------------------------------------------------------------------
void ov7725_uart_callback(void)
{
uart_getchar(OV7725_COF_UART, &ov7725_uart_receive[ov7725_uart_receive_num]);;
ov7725_uart_receive_num++;
if(1==ov7725_uart_receive_num && 0XA5!=ov7725_uart_receive[0]) ov7725_uart_receive_num = 0;
if(3 == ov7725_uart_receive_num)
{
ov7725_uart_receive_num = 0;
ov7725_uart_receive_flag = 1;
}
}
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ڲ<EFBFBD><DAB2>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
// @param UARTN_enum <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
// @param buff <20><>Ҫд<D2AA><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// @return void
// @since v1.0
// Sample usage: <09><><EFBFBD>øú<C3B8><C3BA><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ȳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//-------------------------------------------------------------------------------------------------------------------
void ov7725_set_all_config(UARTN_enum uartn, uint16 buff[OV7725_CONFIG_FINISH-1][2])
{
uint16 temp, i;
uint8 send_buffer[4];
ov7725_uart_receive_flag = 0;
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD>
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>³<EFBFBD>ʼ<EFBFBD><CABC>
for(i=0; i<OV7725_CONFIG_FINISH; i++)
{
send_buffer[0] = 0xA5;
send_buffer[1] = (uint8)buff[i][0];
temp = buff[i][1];
send_buffer[2] = temp>>8;
send_buffer[3] = (uint8)temp;
uart_putbuff(uartn, send_buffer,4);
systick_delay_ms(STM0, 2);
}
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʼ<EFBFBD><CABC><EFBFBD>ɹ<EFBFBD>
while(!ov7725_uart_receive_flag);
ov7725_uart_receive_flag = 0;
while((0xff != ov7725_uart_receive[1]) || (0xff != ov7725_uart_receive[2]));
//<2F><><EFBFBD>ϲ<EFBFBD><CFB2>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>51<35><31>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>eeprom<6F><6D>
}
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͷ<EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
// @param UARTN_enum <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
// @param buff <20><>Ҫ<EFBFBD><D2AA>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// @return void
// @since v1.0
// Sample usage: <09><><EFBFBD>øú<C3B8><C3BA><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ȳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//-------------------------------------------------------------------------------------------------------------------
void ov7725_get_all_config(UARTN_enum uartn, uint16 buff[OV7725_CONFIG_FINISH-1][2])
{
uint16 temp, i;
uint8 send_buffer[4];
for(i=0; i<OV7725_CONFIG_FINISH-1; i++)
{
send_buffer[0] = 0xA5;
send_buffer[1] = OV7725_GET_STATUS;
temp = buff[i][0];
send_buffer[2] = temp>>8;
send_buffer[3] = (uint8)temp;
uart_putbuff(uartn, send_buffer,4);
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ܻش<DCBB><D8B4><EFBFBD><EFBFBD><EFBFBD>
while(!ov7725_uart_receive_flag);
ov7725_uart_receive_flag = 0;
buff[i][1] = ov7725_uart_receive[1]<<8 | ov7725_uart_receive[2];
}
}
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͷ<EFBFBD>̼<EFBFBD><CCBC>
// @param NULL
// @return void
// @since v1.0
// Sample usage: <09><><EFBFBD>øú<C3B8><C3BA><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ȳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//-------------------------------------------------------------------------------------------------------------------
uint16 ov7725_get_id(UARTN_enum uartn)
{
uint16 temp;
uint8 send_buffer[4];
send_buffer[0] = 0xA5;
send_buffer[1] = OV7725_GET_WHO_AM_I;
temp = 0;
send_buffer[2] = temp>>8;
send_buffer[3] = (uint8)temp;
uart_putbuff(uartn, send_buffer,4);
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ܻش<DCBB><D8B4><EFBFBD><EFBFBD><EFBFBD>
while(!ov7725_uart_receive_flag);
ov7725_uart_receive_flag = 0;
return ((uint16)(ov7725_uart_receive[1]<<8) | ov7725_uart_receive[2]);
}
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͷ<EFBFBD>̼<EFBFBD><CCBC>
// @param NULL
// @return void
// @since v1.0
// Sample usage: <09><><EFBFBD>øú<C3B8><C3BA><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ȳ<EFBFBD>ʼ<EFBFBD><CABC>uart3
//-------------------------------------------------------------------------------------------------------------------
uint16 ov7725_get_version(UARTN_enum uartn)
{
uint16 temp;
uint8 send_buffer[4];
send_buffer[0] = 0xA5;
send_buffer[1] = OV7725_GET_STATUS;
temp = OV7725_GET_VERSION;
send_buffer[2] = temp>>8;
send_buffer[3] = (uint8)temp;
uart_putbuff(uartn, send_buffer,4);
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ܻش<DCBB><D8B4><EFBFBD><EFBFBD><EFBFBD>
while(!ov7725_uart_receive_flag);
ov7725_uart_receive_flag = 0;
return ((uint16)(ov7725_uart_receive[1]<<8) | ov7725_uart_receive[2]);
}
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ʼ<EFBFBD><CABC>(<28><><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϺ<D0B6><CFBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɲɼ<C9B2>ͼ<EFBFBD><CDBC>)
// @param NULL
// @return 0
// @since v1.0
// Sample usage:
//-------------------------------------------------------------------------------------------------------------------
void ov7725_uart_init(void)
{
uint8 i;
camera_type = CAMERA_BIN_UART;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
camera_buffer_addr = ov7725_uart_image_bin[0];
boolean interrupt_state = disableInterrupts();
uart_init (OV7725_COF_UART, 9600, OV7725_COF_UART_TX, OV7725_COF_UART_RX); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
enableInterrupts();//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
ov7725_uart_receive_flag = 0;
//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ɹ<EFBFBD> <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>õķ<C3B5>ʽ <20><>ѡһ
//systick_delay_ms(STM0, 1000);//<2F><>ʱ<EFBFBD><CAB1>ʽ
ov7725_get_all_config(OV7725_COF_UART, OV7725_GET_CFG);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>õķ<C3B5>ʽ
ov7725_uart_receive_flag = 0;
ov7725_set_all_config(OV7725_COF_UART, OV7725_CFG);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ñ<EFBFBD><C3B1>ڲ鿴<DAB2><E9BFB4><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ
ov7725_get_all_config(OV7725_COF_UART, OV7725_GET_CFG);
disableInterrupts();
//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD>ʼ<EFBFBD><CABC>
//<2F><>ʼ<EFBFBD><CABC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for(i=0; i<8; i++)
{
gpio_init((PIN_enum)(OV7725_UART_DATA_PIN+i), GPI, 0, PULLUP);
}
eru_dma_init(OV7725_UART_DMA_CH, GET_PORT_IN_ADDR(OV7725_UART_DATA_PIN), camera_buffer_addr, OV7725_UART_PCLK_PIN, FALLING, OV7725_UART_DMA_NUM);
eru_init(OV7725_UART_VSYNC_PIN, FALLING); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>жϣ<D0B6><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>½<EFBFBD><C2BD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD>ж<EFBFBD>
restoreInterrupts(interrupt_state);
}
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>ж<EFBFBD>
// @param NULL
// @return void
// @since v1.0
// Sample usage: <09><>isr.c<><63><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>жϺ<D0B6><CFBA><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD>øú<C3B8><C3BA><EFBFBD><><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6>־λ)
//-------------------------------------------------------------------------------------------------------------------
void ov7725_uart_vsync(void)
{
CLEAR_GPIO_FLAG(OV7725_UART_VSYNC_PIN);
if(!ov7725_uart_finish_flag)//<2F>鿴ͼ<E9BFB4><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>δʹ<CEB4><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򲻿<EFBFBD>ʼ<EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ʳ<EFBFBD>ͻ
{
DMA_SET_DESTINATION(OV7725_UART_DMA_CH, camera_buffer_addr);
dma_start(OV7725_UART_DMA_CH);
}
}
uint8 ov7725_uart_finish_flag = 0;
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷDMA<4D><41><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
// @param NULL
// @return void
// @since v1.0
// Sample usage: <09><>isr.c<><63><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>жϺ<D0B6><CFBA><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD>øú<C3B8><C3BA><EFBFBD><><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6>־λ)
//-------------------------------------------------------------------------------------------------------------------
void ov7725_uart_dma(void)
{
CLEAR_DMA_FLAG(OV7725_UART_DMA_CH);
ov7725_uart_finish_flag = 1;
dma_stop(OV7725_UART_DMA_CH);
}
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>ݽ<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
// @param *data1 Դ<><D4B4>ַ
// @param *data2 Ŀ<>ĵ<EFBFBD>ַ
// @return void
// @since v1.0
// Sample usage: Image_Decompression(da1,dat2[0]);//<2F><>һά<D2BB><CEAC><EFBFBD><EFBFBD>dat1<74><31><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>ά<EFBFBD><CEAC><EFBFBD><EFBFBD>dat2<74><32>.
//-------------------------------------------------------------------------------------------------------------------
void image_decompression(uint8 *data1,uint8 *data2)
{
uint8 temp[2] = {0,255};
uint16 lenth = OV7725_UART_SIZE;
uint8 i = 8;
while(lenth--)
{
i = 8;
while(i--)
{
*data2++ = temp[(*data1 >> i) & 0x01];
}
data1++;
}
}
//-------------------------------------------------------------------------------------------------------------------
// @brief С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷδ<CDB7><CEB4>ѹͼ<D1B9><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>鿴ͼ<E9BFB4><CDBC>
// @param uartn ʹ<>õĴ<C3B5><C4B4>ں<EFBFBD>
// @param image <09><>Ҫ<EFBFBD><D2AA><EFBFBD>͵<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ַ
// @param width ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// @param height ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// @return void
// @since v1.0
// Sample usage: <09><><EFBFBD>øú<C3B8><C3BA><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ȳ<EFBFBD>ʼ<EFBFBD><CABC>uart2
//-------------------------------------------------------------------------------------------------------------------
void seekfree_sendimg_7725(UARTN_enum uartn, uint8 *image, uint16 width, uint16 height)
{
uart_putchar(uartn, 0x00);uart_putchar(uartn, 0xff);uart_putchar(uartn, 0x01);uart_putchar(uartn, 0x01);//<2F><><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
uart_putbuff(uartn, image, width*height/8); //<2F>ٷ<EFBFBD><D9B7><EFBFBD>ͼ<EFBFBD><CDBC>
}