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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? framemgr.c

?? ov7620是采用cmos傳感器技術的攝像頭
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*********************************************************
    Module Name: FrameMgr.c
    Module Date: 04/10/2004
    Module Auth: John Orlando 
    Copyright (c) 2004 John Orlando  All Rights Reserved 

    Description: This modules is responsible for performing
    both medium and high level processing on image data.
    This is performed at both the line level as well as
    the frame level.  It controls the main flow of the
    system, adhering to all the critical timing
    requirements (such as when serial data can be transferred,
    etc).
    *********************************************************/

/*	Includes */
#include <stdlib.h>
#include <string.h>
#include <avr/io.h>
#include "Executive.h"
#include "UIMgr.h"
#include "FrameMgr.h"
#include "CamInterface.h"
#include "UartInterface.h"
#include "Utility.h"
#include "I2CInterface.h"
#include "CamConfig.h"
#include "CommonDefs.h"

/* 	Local Structures and Typedefs */
enum
{
    ST_FrameMgr_idle,
    ST_FrameMgr_TrackingFrame,
    ST_FrameMgr_DumpingFrame
};

typedef unsigned char FrameMgr_State_t;

/*  Definitions */
/* The most objects that can be tracked at any one time is 8.
    This number is determined by the number of bytes that can be
    sent out during a frame (one byte per line, 144 lines per frame)
    with the number of bytes in a tracked object (7) + some wiggle
    room :-) ... I guess this could be increased to around 20 if
    we had enough room and cycles to process objects between lines */
#define MAX_TRACKED_OBJECTS	8

/* This defines the number of bytes that make up a trackedObject_t
    structure...we don't just use sizeof() because there is a fill
    byte in there to cause the structure to align properly */
#define SIZE_OF_TRACKED_OBJECT 7

/* This define is used to turn off the timer overflow interrupt
    that is generated when the PCLK overflows TIMER1 */
#define DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK 0xFB

/* This enum describes the possible colors that can
    be tracked by the system.  This can't be represented as
    simple color names (red, brown, etc) due to the fact that
    the user sets which colors will be associated with which
    bits.  Remember...after the AND operation of the indexed
    color map values executes, either a single bit indicating
    the color should be set, or no bits indicating that the
    color isn't represented in the color map (notTracked). */
enum
{
    notTracked,
    color1,		/* bit 1 color */
    color2,             /* bit 2 color */
    color3,             /* bit 3 color */
    color4,             /* bit 4 color */
    color5,             /* bit 5 color */
    color6,             /* bit 6 color */
    color7,             /* bit 7 color */
    color8              /* bit 8 color */
};

typedef unsigned char trackedColor_t;

/* This structure defines the info that needs to be
    maintained for each trackedObject in the trackingTable */
typedef struct
{
    trackedColor_t  color;
    unsigned char lastLineXStart;
    unsigned char lastLineXFinish;
    unsigned char x_upperLeft;
    unsigned char y_upperLeft;
    unsigned char x_lowerRight;
    unsigned char y_lowerRight;
    unsigned char fillByte;
} trackedObject_t;

/*  Local Variables */
/* The trackedObjectTable is used to hold up to eight tracked objects
    while they are being acquired. */
static trackedObject_t trackedObjectTable[MAX_TRACKED_OBJECTS];
static trackedObject_t *pCurrentTrackedObjectTable = trackedObjectTable;
static unsigned char lineCount = 0;
static FrameMgr_State_t currentState = ST_FrameMgr_idle;
static unsigned char numCurrTrackedObjects = 0;
static unsigned char numPrevTrackedObjects = 0;
static unsigned char trackedLineCount = 0;

/*  Local Functions  */
static void FrameMgr_findConnectedness(void);

/*  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: FrameMgr_init
    Function Description: This function is responsible
    for initializing the FrameMgr.  This includes
    setting up the various buffers and data needed to
    process each frame of image data.
    Inputs:  none
    Outputs: none
    ***********************************************************/
void FrameMgr_init(void)
{
    memset(trackedObjectTable,0x00,sizeof(trackedObjectTable));
}


/***********************************************************
    Function Name: FrameMgr_dispatchEvent
    Function Description: This function is responsible for
    taking an incoming event and performing the needed
    actions with it as pertains to the FrameMgr.
    Inputs:  event - the generated event
    Outputs: none
    ***********************************************************/
void FrameMgr_dispatchEvent(unsigned char event)
{
    switch(event)
    {
    case EV_DUMP_FRAME:
        CamConfig_setCamReg(0x11,0x01);  /* reduce the frame rate for dumping*/
        CamConfig_sendFifoCmds();
        Utility_delay(1000);		/* allow the new frame rate to settle */
        lineCount = 0;
        currentState = ST_FrameMgr_DumpingFrame;
        CamIntAsm_waitForNewDumpFrame(currentLineBuffer,previousLineBuffer);
        break;

    case EV_ENABLE_TRACKING:
        currentState = ST_FrameMgr_TrackingFrame;
        FrameMgr_acquireFrame();
        break;

    case EV_ACQUIRE_FRAME_COMPLETE:
        FrameMgr_processFrame();
        break;

    case EV_PROCESS_FRAME_COMPLETE:
        FrameMgr_acquireFrame();
        break;

    case EV_SERIAL_DATA_RECEIVED:
        if (currentState != ST_FrameMgr_idle)
        {
            /* we need to go back to processing line data, since
                serial data reception interrupted us....just trash the
                frame and act like the frame has been processed, which
                will kick off the system to wait for the next line */
            PUBLISH_EVENT(EV_PROCESS_FRAME_COMPLETE);
        }
        break;

    case EV_DISABLE_TRACKING:
        /* tracking needs to be turned off */
        currentState = ST_FrameMgr_idle;
        break;
    }
}

/***********************************************************
    Function Name: FrameMgr_acquireFrame
    Function Description: This function is responsible for
    beginning of the acquisition of a new frame of data
    from the camera interface. The acquisition of this line
    depends on the current state of the FrameMgr.
    Inputs:  none
    Outputs: none
    ***********************************************************/
void FrameMgr_acquireFrame(void)
{
    if (currentState == ST_FrameMgr_TrackingFrame)
    {
        trackedLineCount = 0;
        numPrevTrackedObjects = numCurrTrackedObjects;
        numCurrTrackedObjects = 0;

        /* clear out the tracking table, and wait for the new frame
            to start */
        memset(trackedObjectTable,0x00,sizeof(trackedObjectTable));
        CamIntAsm_waitForNewTrackingFrame(currentLineBuffer,colorMap);
    }
}

/***********************************************************
    Function Name: FrameMgr_acquireLine
    Function Description: This function is responsible for
    acquiring a line of data from the camera interface.
    The acquisition of this line depends on the current
    state of the FrameMgr.
    Inputs:  none
    Outputs: none
    ***********************************************************/
void FrameMgr_acquireLine(void)
{
    unsigned char tmpLineCount;

    /* clearing out the buffers takes too long...we should
        just overwrite the data here without a problem when
        we start acquiring...at no point do we check for
        a 0x00 value in the current or previous lineBuffers,
        so it was a bit excessive :-)  */

    /* check which state we are in and proceed as needed */
    if (currentState == ST_FrameMgr_DumpingFrame)
    {
        tmpLineCount = lineCount*2;
        /* wait for another VSYNC so we know which frame to use
            to start looking for a line to receive */
        WAIT_FOR_VSYNC_HIGH();
        WAIT_FOR_VSYNC_LOW();

        /* look at lineCount to determine how many HREFs we should
            wait before we start sampling */
        while(tmpLineCount != 0)
        {
            WAIT_FOR_HREF_HIGH();
            tmpLineCount--;
            WAIT_FOR_HREF_LOW();
        }

        /*  we should now be ready to sample our line...*/
        CamIntAsm_acquireDumpLine(currentLineBuffer,previousLineBuffer);
    }
    else if (currentState == ST_FrameMgr_TrackingFrame)
    {
        WAIT_FOR_HREF_LOW();
        CamIntAsm_acquireTrackingLine(currentLineBuffer,colorMap);
    }
}

/***********************************************************
    Function Name: FrameMgr_processLine
    Function Description: This function is responsible for
    parsing the received image line and performing either
    connected region mapping (if in the Tracking state) or
    sending out the raw sampled data (if in the Dumping
    state).
    Inputs:  none
    Outputs: none
    ***********************************************************/
void FrameMgr_processLine(void)
{
    unsigned char i;
    volatile unsigned char dataToSend;

#ifdef DEBUG_TRACKED_LINE
    unsigned char *pSendData;
    unsigned char asciiBuffer[5];
    unsigned char pixelCount = 0;
#endif

    if (currentState == ST_FrameMgr_DumpingFrame)
    {
        /* we want to sit in a tight loop and send the acquired data
            sitting in current and previous line buffers out the serial
            port...it is sent out the serial port immediately instead
            of going into the UIMgr tx fifo because we can't do anything
            until its sent out anyway...may as well just get it out now	*/

        /* currentLineBuffer is getting "g" previousLineBuffer is getting "b-r" */
        UartInt_txByte(0x0B);			/* send the header byte */
        UartInt_txByte(lineCount);              /* send the line count */
        for (i=0; i<NUM_PIXELS_IN_A_DUMP_LINE; i+=2)
        {
            /* when a dump line is sampled, the upper byte can potentially
                have garbage in it...we don't have time to mask it off as we're
                sampling, so it is done here before we send it out...we also
                combine the samples together so we really are sending up a
                sample for line N as well as line N+1 */
            dataToSend = currentLineBuffer[i];
            dataToSend &= 0x0F;
            dataToSend <<= 4;
            dataToSend |= (previousLineBuffer[i] & 0x0F);

            /* dataToSend should be packed now */
            UartInt_txByte(dataToSend);

            /* flip the colors around since we are doing all G on Y and BR on UV */
            dataToSend = previousLineBuffer[i+1];
            dataToSend &= 0x0F;
            dataToSend <<= 4;
            dataToSend |= (currentLineBuffer[i+1] & 0x0F);

            /* dataToSend should be packed now */
            UartInt_txByte(dataToSend);
        }
        UartInt_txByte(0x0F);  /* send line end */
                               /* once all the data is sent, increment out line count by 2 since
                                   we really get 2 lines worth of pixels on each pass */
                               /* Update...increment only by 1, but only send 72 double-lines */
        lineCount++;

        /* check to see if we have retrieved all of the needed lines */
        if (lineCount >= 72)  /* half 144, since we send two lines at a time */
        {
            /* we're done, so send the dump complete?...nope, just change
                states and we should be fine */
            lineCount = 0;
            currentState = ST_FrameMgr_idle;

            /* disable the PCLK counting overflow interrupt */
            TIMSK &= DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK;

            CamConfig_setCamReg(0x11,0x00);  /* reset the frame rate to normal*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美成人午夜| 国产精品福利一区| 欧美国产激情二区三区| 一区二区三区日韩| 国产乱码精品1区2区3区| 91黄色免费观看| 久久亚洲影视婷婷| 日韩国产一二三区| 91丨九色丨国产丨porny| 26uuu亚洲综合色欧美| 亚洲图片欧美色图| 一本大道久久a久久综合婷婷| 欧美电影免费观看高清完整版| 一区二区三区在线影院| 懂色av噜噜一区二区三区av| 欧美一区二区不卡视频| 亚洲激情网站免费观看| 成人午夜大片免费观看| 2023国产精品自拍| 免费成人结看片| 欧美精品高清视频| 亚洲h在线观看| 欧美性大战xxxxx久久久| 亚洲欧洲制服丝袜| 99久久综合狠狠综合久久| 欧美经典三级视频一区二区三区| 麻豆成人免费电影| 欧美成人女星排行榜| 麻豆国产91在线播放| 精品国产乱码久久久久久老虎| 日本亚洲一区二区| 欧美一二三四在线| 日韩成人免费看| 日韩欧美亚洲国产另类| 麻豆久久久久久| 26uuu国产一区二区三区| 久久av中文字幕片| 久久网这里都是精品| 国产精品资源在线看| 久久久国际精品| 成人精品小蝌蚪| 亚洲欧美综合另类在线卡通| 一本到高清视频免费精品| 亚洲韩国一区二区三区| 91精品国产综合久久福利软件| 免费视频一区二区| 久久午夜色播影院免费高清| 成人黄色小视频| 亚洲欧美偷拍卡通变态| 欧美日韩夫妻久久| 国内成人精品2018免费看| 国产日韩三级在线| 色婷婷狠狠综合| 日日夜夜精品视频天天综合网| 777欧美精品| 国产一区激情在线| 亚洲色图视频免费播放| 欧美夫妻性生活| 国产成人精品免费看| 亚洲女人****多毛耸耸8| 91精品久久久久久久久99蜜臂| 国产精品一级片在线观看| 亚洲免费在线视频一区 二区| 91精品国产色综合久久不卡电影| 国产成人在线影院| 亚洲成人激情av| 精品不卡在线视频| 色综合天天综合色综合av | 亚洲午夜久久久| 这里只有精品电影| 粉嫩一区二区三区在线看| 亚洲自拍另类综合| 国产校园另类小说区| 欧美在线一二三四区| 国产精品一区二区91| 亚洲第一久久影院| 18成人在线视频| 日韩欧美一区中文| 欧美视频一区在线观看| 国产成人亚洲精品青草天美| 五月婷婷激情综合网| 中文在线免费一区三区高中清不卡| 欧美日韩午夜在线| 91在线观看一区二区| 国产综合一区二区| 男人的j进女人的j一区| 亚洲一卡二卡三卡四卡五卡| 国产片一区二区三区| 日韩一级片在线播放| 欧美视频中文字幕| a级精品国产片在线观看| 激情欧美一区二区三区在线观看| 亚洲黄色免费网站| 欧美国产成人精品| 精品国产1区二区| 91精品国产91久久久久久一区二区 | 国产美女精品人人做人人爽| 亚洲成人av电影| 亚洲免费在线播放| 国产精品久久久久久久久果冻传媒| 日韩天堂在线观看| 欧美一区二区三区视频在线 | 一本到不卡免费一区二区| 国产精品香蕉一区二区三区| 麻豆精品精品国产自在97香蕉| 五月综合激情日本mⅴ| 一区二区三区影院| 亚洲黄色av一区| 亚洲欧美区自拍先锋| 亚洲国产高清不卡| 国产精品欧美久久久久无广告| 久久亚洲捆绑美女| 国产色产综合产在线视频| 久久久久久**毛片大全| 精品国产乱子伦一区| 久久久亚洲精华液精华液精华液| 精品久久久久久最新网址| 久久中文娱乐网| 久久精品一区蜜桃臀影院| 日本一区二区视频在线观看| 国产视频一区在线播放| 中文字幕不卡的av| 亚洲三级久久久| 亚洲一区自拍偷拍| 天堂在线一区二区| 看电影不卡的网站| 国产麻豆视频一区| 成人爱爱电影网址| 色婷婷av一区二区三区大白胸| 日本久久电影网| 91超碰这里只有精品国产| 欧美不卡一二三| 亚洲欧洲精品天堂一级| 亚洲男同性视频| 视频一区免费在线观看| 捆绑调教美女网站视频一区| 国产麻豆日韩欧美久久| 91一区二区在线观看| 欧美日韩免费观看一区二区三区| 欧美精选在线播放| 久久亚洲综合色| 亚洲黄色片在线观看| 捆绑紧缚一区二区三区视频| 国产精品一区二区在线看| 91网站视频在线观看| 91麻豆精品国产自产在线观看一区| 精品国产不卡一区二区三区| 最新久久zyz资源站| 日欧美一区二区| 成熟亚洲日本毛茸茸凸凹| 欧美综合视频在线观看| 精品国内二区三区| 亚洲综合无码一区二区| 国内精品自线一区二区三区视频| 日本乱人伦aⅴ精品| 欧美一二三在线| 亚洲精品视频在线看| 免费观看日韩电影| 在线亚洲免费视频| 国产欧美日韩不卡| 免费精品视频在线| 色婷婷亚洲精品| 国产亚洲欧美激情| 美脚の诱脚舐め脚责91| 色综合色狠狠天天综合色| 26uuu亚洲婷婷狠狠天堂| 亚洲va中文字幕| 91在线视频18| 久久久久国产精品免费免费搜索| 亚洲伊人色欲综合网| 99久久亚洲一区二区三区青草| 精品国产91九色蝌蚪| 婷婷综合另类小说色区| 91亚洲国产成人精品一区二三| 精品va天堂亚洲国产| 日本伊人午夜精品| 欧美日韩小视频| 亚洲一区中文在线| 99精品视频在线免费观看| 久久久久99精品一区| 麻豆国产91在线播放| 欧美顶级少妇做爰| 亚洲成a天堂v人片| 91福利视频网站| 最新不卡av在线| 91网站视频在线观看| 中文无字幕一区二区三区| 韩国一区二区在线观看| 在线不卡的av| 五月激情六月综合| 欧美日韩国产综合一区二区| 亚洲黄色片在线观看| 日本道精品一区二区三区| 亚洲视频综合在线| 99久久精品免费看| 成人欧美一区二区三区白人| 99视频在线观看一区三区| 亚洲天堂福利av| 欧美性猛交xxxx乱大交退制版| 亚洲美女在线一区|