亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? caminterface.c

?? 基于avr單片機(jī)的嵌入式攝像機(jī)的源程序
?? C
字號(hào):
/*
    Copyright (C) 2004    John Orlando
    
   AVRcam: a small real-time image processing engine.

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

    You should have received a copy of the GNU General Public
    License along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

   For more information on the AVRcam, please contact:

   john@jrobot.net

   or go to www.jrobot.net for more details regarding the system.
*/
/***********************************************************
	Module Name: CamInterface.c
	Module Date: 04/12/2004
	Module Auth: John Orlando
	
	Description: This file is responsible for providing an
	interface to the OV6620 camera hardware.  This includes
	an interface to CamInterface.S for certain low-level,
	optimized camera access routines.
    
    Revision History:
    Date        Rel Ver.    Notes
    4/10/2004      0.1     Module created
    6/30/2004      1.0     Initial release for Circuit Cellar
                           contest.
    11/15/2004     1.2     ifdef'd out the resetCam routine, since
                           resetting the cam now causes the OV6620's
                           clock to not be output (we have to start
                           it up after each reset with the external
                           tiny12 processor).
    1/16/2005      1.4     Ensure that the TCCR1B register is set so
                           nothing is clocking timer1 at startup.                             
***********************************************************/

/*	Includes */
#include <avr/interrupt.h>
#include <avr/signal.h>
#include <avr/sleep.h>
#include <avr/eeprom.h>
#include <stdlib.h>
#include <string.h>
#include "CommonDefs.h"
#include "CamInterface.h"
#include "Utility.h"
#include "UIMgr.h"
#include "Executive.h"
#include "UartInterface.h"

/*  Local Variables */

/* 	Local Structures and Typedefs */

/*  Definitions */
//#define OUTPUT_INITIAL_COLOR_MAP 1

#define FAST_ACQUIRE 1
#define CAM_G_BUS          	PINB
#define CAM_G_BUS_DIR      	DDRB
#define CAM_RB_BUS          PINC
#define CAM_RB_BUS_DIR 		DDRC

#define CAM_CONTROL_PORT     PORTD
#define CAM_CONTROL_PORT_DIR DDRD
#define CAM_RESET_LINE       BIT7
#define CAM_PIXEL_CLK_COUNT  BIT5
#define CAM_HREF             BIT4
#define CAM_PIXEL_CLK_INT    BIT3
#define CAM_VSYNC            BIT2

/*  Global Variables */
/* NOTE: This file MUST appear first in the Makefile for these variables to
be placed properly in RAM */

/* The colorMap[] table provides the membership lookup table to convert 
RGB or YUV pixel values into actual colors.  The membership table contains
16 elements for each color channel, concatenated together.  The Red (or Y)
value is located in the first 16 bytes, the G (or U) value is located in
the second 16 bytes, and the B (or V) value is located in the last 16 bytes:

    ----------------------------------------------------------------------------------
    |red0|red1|red2|...|red15|green0|green1|green2|...|green15|blue0|blue1|...|blue15|
mem:|0x00 0x01 0x02     0x15   0x16   0x17   0x18       0x31   0x32  0x33       0x47 |
    ---------------------------------------------------------------------------------
Thus, the red lookup is accessed at colorMap+0, the green lookup is accessed 
at colorMap+16, and the blue lookup is accessed at colorMap+32.  */	
unsigned char colorMap[NUM_ELEMENTS_IN_COLOR_MAP] __attribute__ ((section (".noinit")));

/*  Extern Variables */
/* These two buffers hold the current and previous lines
of pixel data.  They are sized to the worst case scenario,
where the color changes between every pixel (unrealistic).
The format of each buffer is for all the even bytes to hold
the run-length, and the odd bytes to hold the color data. */

/* In addition, if we are in frameDump mode, we use these buffers
to store the acquired line data...we are actually grabbing ALL of the
pixels in a line (176) instead of the 88 we get normally during tracking.
But since we have enough to hold 88-RLE blocks, we already have the 176
allocated for this... */
unsigned char currentLineBuffer[LENGTH_OF_LINE_BUFFER];
unsigned char previousLineBuffer[LENGTH_OF_LINE_BUFFER];

/*  Extern Functions */
/* These functions are located in assembly files, and thus
must be externed here so they can be referenced in the source below. */
extern void CamIntAsm_waitForNewTrackingFrame(unsigned char *pBuffer, unsigned char *pMemLookup);
extern void CamIntAsm_waitForNewDumpFrame(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);
extern void CamIntAsm_acquireTrackingLine(unsigned char *pBuffer, unsigned char *pMemLookup);
extern void CamIntAsm_acquireDumpLine(unsigned char *pCurrBuffer, unsigned char *pPrevBuffer);

/***********************************************************
	Function Name: CamInt_init
	Function Description: This function is responsible
	for initializing the camera interface.  This includes
	setting up the i/o ports that are used to read the
	camera busses, as well as resetting the camera.
	Inputs:  none
	Outputs: none
***********************************************************/	
void CamInt_init(void)
{
#if OUTPUT_INITIAL_COLOR_MAP
	unsigned char asciiBuffer[5];
    unsigned char i;
#endif    
    
	/* set up the mega8 ports that will be interfacing
	with the camera */	
	CAM_CONTROL_PORT_DIR |= (1<<CAM_RESET_LINE); /* cam reset is output */
	CAM_CONTROL_PORT_DIR |= 0x80;   /* set just the MSB as an output */
	CAM_CONTROL_PORT_DIR &= 0xFB;   /* make sure bit2 is clear (input) */
	CAM_CONTROL_PORT &= 0x7F;   /* set reset line low */
	CAM_G_BUS_DIR &= 0xF0;  /* 4-bit G bus all inputs */
    CAM_G_BUS_DIR |= 0xF0;  /* disable the pull-up on PB4 and PB5 */
	CAM_RB_BUS_DIR &= 0xF0;  /* 4-bit RB bus all inputs */
	
    /* ensure that timer1 is disabled to start...eventually, when PCLK needs
    to feed timer1 through the external counter, it will be enabled on an
    "as needed" basis...*/
	TCCR1B &= ~( (1<<CS12)|(1<<CS11)|(1<<CS10) );
	
	/* we'll turn on the interrupt after we assign the initial TCNT value */
	
	/* set up External Interrupt1 to interrupt us on rising edges (HREF)...
	this is needed to indicate when the first pixel of each line is about to start, so
	we can synch up with it...this interrupt will be disabled once HREF goes high */
	
	MCUCR |= (1<<ISC11) | (1<<ISC10);  /* rising edge interrupt */
	/* the interrupt will be enabled when we are ready to detect the rising edge of
	HREF...its now primed and ready to go */
	
	/* set up External Interrupt0 to interrupt us on rising edges (VSYNC) */
	MCUCR |= (1<<ISC01) | (1<<ISC00);	/* rising edge interrupt */ 
	GICR  |= (1<<INT0);    /* interrupt request enabled */
	
	/* set up TimerO to count and be clocked from an external pulse source
	(HREF) on falling edges...eventually, we need to enable the interrupt
	for this!  FIX THIS */
	TCCR0 = (1<<CS02)|(1<<CS01)|(0<<CS00);
	
	/* setting up the PCLK counter with Timer1 will be done right after
	we start receiving pixels in each line...we sacrifice the first pixel
	in each line, but we'll account for it...*/
	
	/* set up the mega8 so that its sleep mode puts it in an IDLE sleep
	mode, where it can wake up as fast as possible */
	set_sleep_mode(SLEEP_MODE_IDLE);
	/* umm....we need to actually enable the sleep mode...*/
	MCUCR |= 0x80;
	
	/* initialize the memLookup table */
	memset(colorMap,0x00,NUM_ELEMENTS_IN_COLOR_MAP);   
	
	/* read the color map out of EEPROM */
	eeprom_read_block(colorMap, (unsigned char*)0x01,NUM_ELEMENTS_IN_COLOR_MAP);

#if OUTPUT_INITIAL_COLOR_MAP    
    UIMgr_txBuffer("\r\n",2);
    for (i=0; i<NUM_ELEMENTS_IN_COLOR_MAP; i++)
	{
		memset(asciiBuffer,0x00,5);
		itoa(colorMap[i],asciiBuffer,10);
		UIMgr_txBuffer(asciiBuffer,3);
		UIMgr_txBuffer(" ",1);
		if (i==15 || i == 31)
		{
			/* break up the output */
			UIMgr_txBuffer("\r\n",2);
		}
	}
#endif    

#ifndef NO_CRYSTAL
	CamInt_resetCam();	
#endif    
}

/***********************************************************
	Function Name: CamInt_resetCam
	Function Description: This function is responsible
	for resetting the camera.  This is accomplished by
	toggling the reset line on the OV6620 for ~100 mS.
	Inputs:  none
	Outputs: none
    IMPORTANT NOTE: This function has effectively been removed
    since resetting the camera now causes the camera to not
    output the clock signal.  Thus, if we reset the cam, the
    AVR has no clock, and thus doesn't run...
***********************************************************/	
void CamInt_resetCam(void)
{

#if 0
	CAM_CONTROL_PORT |= (1<<CAM_RESET_LINE); /* cam reset line high */
	Utility_delay(500);
	CAM_CONTROL_PORT &= (0<<CAM_RESET_LINE); /* cam reset line low */
	Utility_delay(100);
#endif    
}


?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线观看视频一区二区 | 久久精品国产亚洲5555| 欧美自拍丝袜亚洲| 亚洲一级电影视频| 欧美精品色一区二区三区| 五月开心婷婷久久| 欧美电视剧免费全集观看| 国内欧美视频一区二区| 久久精品视频免费| 91小视频免费看| 亚洲免费大片在线观看| 欧美日韩视频一区二区| 免费成人性网站| 久久午夜老司机| 99这里只有久久精品视频| 一区二区三区四区视频精品免费| 国产精品天美传媒| eeuss鲁片一区二区三区在线看| 亚洲女性喷水在线观看一区| 欧美日韩免费高清一区色橹橹| 日韩不卡手机在线v区| 欧美日韩中文另类| 日本不卡1234视频| 国产精品久久久久久亚洲毛片| 色婷婷av一区二区三区大白胸| 天堂在线一区二区| 亚洲妇熟xx妇色黄| 日韩欧美在线综合网| 成人免费视频caoporn| 一区二区在线看| 精品国产欧美一区二区| 成人av资源站| 免费看欧美美女黄的网站| 国产拍揄自揄精品视频麻豆| 欧美专区亚洲专区| 国产精品自拍av| 亚洲最新视频在线播放| 久久久久久久久久久久久女国产乱| 91麻豆swag| 韩国欧美一区二区| 玉足女爽爽91| 国产日韩精品视频一区| 欧美日韩不卡一区二区| www.综合网.com| 久久国产精品露脸对白| 亚洲综合一区二区精品导航| 日本一区二区在线不卡| 欧美一区二区不卡视频| 欧美丝袜丝交足nylons图片| 从欧美一区二区三区| 青青草成人在线观看| 亚洲自拍偷拍网站| 亚洲视频 欧洲视频| 国产午夜亚洲精品午夜鲁丝片| 欧美人与禽zozo性伦| 色呦呦网站一区| 成人精品高清在线| 国产成人综合亚洲网站| 蜜桃av一区二区在线观看| 亚洲国产综合91精品麻豆| 亚洲欧美电影院| 国产精品国产三级国产普通话三级| 精品国产乱码久久久久久浪潮| 欧美日韩国产123区| 91麻豆国产香蕉久久精品| 丁香六月综合激情| 国产成人午夜精品5599| 国产激情一区二区三区桃花岛亚洲| 麻豆精品一区二区| 日本美女一区二区三区视频| 一区二区国产视频| 亚洲欧美偷拍卡通变态| 亚洲欧美激情小说另类| 国产精品久久99| 国产精品水嫩水嫩| 国产精品三级视频| 国产精品福利一区二区三区| 国产欧美精品一区| 国产精品三级电影| 亚洲欧美日本在线| 亚洲综合在线免费观看| 亚洲一区二区三区四区五区黄| 亚洲自拍偷拍av| 亚洲成人资源网| 免费成人美女在线观看.| 久久99国产精品免费网站| 精品无人码麻豆乱码1区2区 | 国内精品在线播放| 国产精品一区二区x88av| 国产综合色精品一区二区三区| 国产尤物一区二区在线| 国产成人在线视频网址| 成人18视频在线播放| 色域天天综合网| 欧美日韩亚洲丝袜制服| 欧美一区在线视频| 久久综合999| 国产精品热久久久久夜色精品三区| 中文字幕一区二区在线播放| 玉足女爽爽91| 美日韩黄色大片| 成人精品视频一区二区三区尤物| 日本精品视频一区二区三区| 欧美日韩高清在线| 精品久久久久久无| 亚洲三级在线播放| 日韩高清不卡一区| 国产精品66部| 欧美午夜精品免费| 精品国产免费一区二区三区四区 | 国产欧美日韩精品一区| 亚洲欧洲国产日本综合| 亚洲成人免费电影| 国产综合色产在线精品| 一本一本久久a久久精品综合麻豆| 在线观看免费视频综合| 精品美女在线观看| 亚洲激情在线播放| 韩国三级在线一区| 欧美天堂亚洲电影院在线播放| 精品国产一区二区三区不卡| 亚洲男人天堂一区| 国内精品久久久久影院薰衣草| av在线一区二区| 欧美成人精品1314www| 亚洲精品国产a| 精品无人码麻豆乱码1区2区 | 日本女人一区二区三区| 99久免费精品视频在线观看| 欧美精品一卡二卡| 中文乱码免费一区二区| 亚洲一区成人在线| 懂色一区二区三区免费观看 | 91香蕉国产在线观看软件| 日韩一区二区免费视频| 亚洲黄色免费网站| 成人av免费在线观看| 精品国产三级电影在线观看| 亚洲国产成人av| 99久久免费精品| 国产亚洲精品7777| 久久精品国产精品亚洲红杏| 欧美日韩一区二区欧美激情| 日韩一区欧美小说| 国内精品国产成人国产三级粉色| 精品视频一区二区三区免费| 亚洲欧洲av另类| 国产福利一区二区三区视频| 日韩一区二区三区在线视频| 亚洲国产三级在线| 91福利视频久久久久| 最新成人av在线| 成人h精品动漫一区二区三区| 久久亚洲综合av| 免费在线观看不卡| 欧美裸体bbwbbwbbw| 亚洲影视资源网| 在线观看亚洲专区| 日韩码欧中文字| 91香蕉视频污在线| 亚洲另类春色校园小说| 91亚洲精品久久久蜜桃网站| 国产精品久久久久影院亚瑟| 成人一区在线观看| 国产亚洲精品超碰| 成人中文字幕在线| 国产精品色婷婷久久58| 国产99精品在线观看| 国产精品网曝门| 99精品热视频| 亚洲人成人一区二区在线观看| 不卡在线视频中文字幕| 亚洲少妇30p| 在线观看视频一区| 亚洲国产毛片aaaaa无费看| 91福利视频网站| 亚洲成人免费视频| 91精品国产91久久久久久最新毛片| 日本va欧美va欧美va精品| 欧美大尺度电影在线| 另类小说一区二区三区| 久久色.com| av在线一区二区三区| 亚洲国产另类av| 日韩午夜av一区| 国产精品乡下勾搭老头1| 国产精品污污网站在线观看| 91一区二区三区在线播放| 亚洲午夜av在线| 精品国产精品一区二区夜夜嗨| 国产麻豆91精品| 亚洲啪啪综合av一区二区三区| 91国偷自产一区二区开放时间 | 717成人午夜免费福利电影| 蜜桃av一区二区三区电影| 日本一区二区免费在线| 91老师片黄在线观看| 视频一区视频二区中文字幕| 精品国产精品网麻豆系列| 97精品视频在线观看自产线路二|