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

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

?? uimgr.c

?? The AVRcam source files were built using the WinAVR distribution (version 3.3.1 of GCC). I haven t
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/***********************************************************
    Module Name: UIMgr.c
    Module Date: 04/10/2004
    Module Auth: John Orlando 
    Copyright (c) 2004 John Orlando  All Rights Reserved 

    Description: This module is responsible for providing
    the processing to manage the user interface of the
    system.  This user interface is provided via the UART.
    This module handles the incoming serial commands, and
    performs the needed functionality.  It is then
    responsible for generating any needed response to
    the external entity.
    ***********************************************************/

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

/* 	Local Structures and Typedefs */

typedef enum
{
    getVersionCmd,
    pingCmd,
    setCameraRegsCmd,
    dumpFrameCmd,
    enableTrackingCmd,
    disableTrackingCmd,
    setColorMapCmd,
    resetCameraCmd,
    noCmd,
    invalidCmd
} UIMgr_Cmd_t;

typedef enum
{
    setRed,
    setGreen,
    setBlue
} setColorState_t;


/*  Local Variables */
static unsigned char charCount = 0;
static unsigned char charIndex = 0;
static unsigned char asciiTokenBuffer[MAX_TOKEN_LENGTH+1]; /* +1 to ensure NULL at end */
static unsigned char tokenCount = 0;
static unsigned char tokenBuffer[MAX_TOKEN_COUNT];
static UIMgr_Cmd_t receivedCmd = noCmd;
static unsigned char AVRcamVersion[] = "AVRcam v1.0\r";

/*  Local Function Declaration */
static unsigned char UIMgr_readRxFifo(void);
static unsigned char UIMgr_readTxFifo(void);
static unsigned char UIMgr_readRxFifo(void);
static void UIMgr_sendNck(void);
static void UIMgr_sendAck(void);
static void UIMgr_convertTokenToCmd(void);
static void UIMgr_convertTokenToValue(void);
static void UIMgr_executeCmd(void);

/*  Extern Variables */
unsigned char UIMgr_rxFifo[UI_MGR_RX_FIFO_SIZE];
unsigned char UIMgr_rxFifoHead=0;
unsigned char UIMgr_rxFifoTail=0;

unsigned char UIMgr_txFifo[UI_MGR_TX_FIFO_SIZE];
unsigned char UIMgr_txFifoHead=0;
unsigned char UIMgr_txFifoTail=0;

/*  Definitions */
#define IS_DATA_IN_TX_FIFO() (!(UIMgr_txFifoHead == UIMgr_txFifoTail))
#define IS_DATA_IN_RX_FIFO() (!(UIMgr_rxFifoHead == UIMgr_rxFifoTail))

/***********************************************************
    Function Name: UIMgr_init
    Function Description: This function is responsible for
    initializing the UIMgr module.  It sets up the fifo
    used to hold incoming data, etc.
    Inputs:  none
    Outputs: none
    ***********************************************************/
void UIMgr_init(void)
{
    memset(asciiTokenBuffer,0x00,MAX_TOKEN_LENGTH+1);
    memset(tokenBuffer,0x00,MAX_TOKEN_COUNT);
    memset(UIMgr_txFifo,0x00,UI_MGR_TX_FIFO_SIZE);
    memset(UIMgr_rxFifo,0x00,UI_MGR_RX_FIFO_SIZE);
}

/***********************************************************
    Function Name: UIMgr_dispatchEvent
    Function Description: This function is responsible for
    processing events that pertain to the UIMgr.
    Inputs:  event - the generated event
    Outputs: none
    ***********************************************************/
void UIMgr_dispatchEvent(unsigned char event)
{
    switch(event)
    {
    case EV_ACQUIRE_LINE_COMPLETE:
        UIMgr_transmitPendingData();
        break;

    case EV_SERIAL_DATA_RECEIVED:
        UIMgr_processReceivedData();
        break;

    case EV_SERIAL_DATA_PENDING_TX:
        UIMgr_flushTxBuffer();
        break;
    }
}
/***********************************************************
    Function Name: UIMgr_transmitPendingData
    Function Description: This function is responsible for
    transmitting a single byte of data if data is waiting
    to be sent.  Otherwise, if nothing is waiting, the
    function just returns.
    Inputs:  none
    Outputs: none
    ***********************************************************/
void UIMgr_transmitPendingData(void)
{
    if (IS_DATA_IN_TX_FIFO() == TRUE)
    {
        /* data is waiting...send a single byte */
        UartInt_txByte( UIMgr_readTxFifo() );
    }
}
/***********************************************************
    Function Name: UIMgr_processReceivedData
    Function Description: This function is responsible for
    parsing any serial data waiting in the rx fifo
    Inputs:  none
    Outputs: none
    ***********************************************************/
void UIMgr_processReceivedData(void)
{
    unsigned char tmpData = 0;

    /* still need to add a mechanism to handle token counts
        that are excessive!!! FIX ME!!! */
    while(IS_DATA_IN_RX_FIFO() == TRUE)
    {
        tmpData = UIMgr_readRxFifo();
        if (tmpData == '\r')
        {
            /* we have reached a token separator */
            if (tokenCount == 0)
            {
                /* convert the command */
                UIMgr_convertTokenToCmd();
            }
            else
            {
                /* convert a value */
                UIMgr_convertTokenToValue();
                tokenCount++;
            }
            /* either way, it is time to try to process the received
                token list since we have reached the end of the cmd. */
            Utility_delay(100);
            if (receivedCmd == invalidCmd ||
                receivedCmd == noCmd )
            {
                UIMgr_sendNck();
                PUBLISH_EVENT(EV_SERIAL_DATA_PENDING_TX);
            }
            else
            {
                UIMgr_sendAck();
                /* publish the serial data pending event, so it
                    will push the ACK out before we execute the cmd */
                PUBLISH_EVENT(EV_SERIAL_DATA_PENDING_TX);
                UIMgr_executeCmd();
            }

            /* reset any necessary data */
            tokenCount = 0;
            memset(tokenBuffer,0x00,MAX_TOKEN_COUNT);
        }
        else if (tmpData == ' ')  /* space char */
        {
            /* the end of a token has been reached */
            if (tokenCount == 0)
            {
                UIMgr_convertTokenToCmd();
                tokenCount++;
            }
            else
            {
                /* check to see if this token is going to push
                    us over the limit...if so, abort the transaction */
                if (tokenCount+1 >= MAX_TOKEN_COUNT)
                {
                    /* we received too many tokens, and
                        need to NCK this request, since its too
                        large...reset everything...*/
                    charCount=0;
                    charIndex=0;
                    tokenCount=0;
                    receivedCmd = invalidCmd;
                }
                else
                {
                    /* tokenCount is still in range...*/
                    UIMgr_convertTokenToValue();
                    tokenCount++;
                }
            }
        }
        else if ( (tmpData >= 'A' && tmpData <= 'Z') ||
                 (tmpData >= '0' && tmpData <= '9') )
        {
            /* a valid range of token was received */
            asciiTokenBuffer[charIndex] = tmpData;
            charCount++;
            charIndex++;
            if (charCount > MAX_TOKEN_LENGTH)
            {
                /* we have received a token that cannot be handled...
                    set the received cmd to an invalid cmd, and wait
                    for the \r to process it */
                receivedCmd = invalidCmd;
                charIndex = 0;  /* ...so we won't overwrite memory */
            }
        }
        else
        {
            /* an invalid character was received */
            receivedCmd = invalidCmd;
        }
    }  /* end while */

    asm volatile("clt"::);  /* clear out the T flag in case it wasn't
                                cleared already */
}

/***********************************************************
    Function Name: UIMgr_executeCmd
    Function Description: This function is responsible for
    executing whatever cmd is stored in the receivedCmd
    object.
    Inputs:  none
    Outputs: none
    ***********************************************************/
static void UIMgr_executeCmd(void)
{
    unsigned char i;
    unsigned char *pData;
#if	DEBUG_COLOR_MAP
    unsigned char asciiBuffer[5];
#endif

    if (receivedCmd == pingCmd)
    {
    }
    else if (receivedCmd == getVersionCmd)
    {
        pData = AVRcamVersion;
        while(*pData != 0)
        {
            UIMgr_writeTxFifo(*pData++);
        }
    }
    else if (receivedCmd == resetCameraCmd)
    {
        CamInt_resetCam();
    }
    else if (receivedCmd == dumpFrameCmd)
    {
        /* publish the event that will indicate that
            a request has come to dump a frame...this will
            be received by the FrameMgr, which will begin
            dumping the frame...a short delay is needed
            here to keep the Java demo app happy (sometimes
            it wouldn't be able to receive the serial data
            as quickly as AVRcam can provide it). */
        Utility_delay(100);
        PUBLISH_EVENT(EV_DUMP_FRAME);
    }
    else if (receivedCmd == setCameraRegsCmd)
    {
        /* we need to gather the tokens and
            build config cmds to be sent to the camera */
        for (i=1; i<tokenCount; i+=2)  /* starts at 1 since first token
                                           is the CR cmd */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
三级成人在线视频| 99久久99久久免费精品蜜臀| 亚洲女同一区二区| 国产亚洲短视频| 欧美一区二区在线免费播放| 91麻豆swag| 成人av手机在线观看| 国产成人午夜片在线观看高清观看| 日本三级亚洲精品| 午夜精品久久久久影视| 亚洲精品乱码久久久久久久久| 国产日产精品一区| 欧美国产精品v| 久久久91精品国产一区二区精品| 欧美视频中文字幕| 在线看日本不卡| 91福利在线播放| 色播五月激情综合网| 91片黄在线观看| 一本到高清视频免费精品| 成人av在线网| 99精品视频在线观看| www.久久久久久久久| 国产麻豆一精品一av一免费 | 精品精品国产高清a毛片牛牛 | 欧美日韩中字一区| 在线观看网站黄不卡| 欧美午夜精品久久久| 欧美日韩你懂得| 91精品国产免费| 日韩一区二区三| 久久天堂av综合合色蜜桃网| 国产欧美日韩另类一区| 国产精品久久久久久亚洲伦| 亚洲色图第一区| 亚洲综合久久av| 日韩国产精品久久| 激情图区综合网| 国产成人精品一区二| av成人老司机| 在线观看亚洲一区| 日韩一区二区三区四区五区六区| 日韩一级免费观看| 国产亚洲精品精华液| 国产精品久久久久久久岛一牛影视| 亚洲制服丝袜在线| 狠狠狠色丁香婷婷综合激情| aaa亚洲精品一二三区| 91精品欧美福利在线观看| 欧美国产日产图区| 天堂蜜桃一区二区三区| 成人性生交大片免费看中文网站| 欧美日韩综合色| 中文无字幕一区二区三区| 亚洲成a人片综合在线| 高清国产一区二区| 在线观看91av| 中文字幕在线观看一区二区| 日韩国产一区二| 91亚洲国产成人精品一区二区三| 欧美一区二区人人喊爽| 综合激情网...| 国产综合久久久久久久久久久久| 色婷婷综合五月| 国产午夜精品美女毛片视频| 日日摸夜夜添夜夜添国产精品| 不卡的av电影在线观看| 日韩精品一区二区三区三区免费| 亚洲少妇中出一区| 国产精品一区二区三区四区| 在线免费观看成人短视频| 国产片一区二区| 麻豆久久久久久久| 欧美日韩国产三级| 亚洲免费毛片网站| av电影天堂一区二区在线| 久久综合色天天久久综合图片| 图片区日韩欧美亚洲| 在线一区二区视频| 亚洲丝袜制服诱惑| 国产很黄免费观看久久| 欧美一区二区三区公司| 亚洲成人福利片| 91国产精品成人| 亚洲摸摸操操av| 波多野结衣中文字幕一区二区三区| 精品国内片67194| 日本vs亚洲vs韩国一区三区| 在线这里只有精品| 亚洲精品中文字幕乱码三区| 成人av网站在线观看免费| 久久久久97国产精华液好用吗| 久久国产精品99精品国产| 4438成人网| 日本vs亚洲vs韩国一区三区二区| 欧美日韩国产一区二区三区地区| 亚洲影视在线播放| 色香蕉成人二区免费| 亚洲美女在线一区| 91福利资源站| 激情国产一区二区| 1024国产精品| 在线欧美日韩精品| 国产99久久久久久免费看农村| 亚洲r级在线视频| 日韩三级精品电影久久久| 精品一区二区三区视频在线观看| 国产精品久久看| 欧美一区二区日韩| 99久久综合狠狠综合久久| 亚洲乱码精品一二三四区日韩在线| 欧美综合一区二区| 国产精品久久久久影视| 青青草国产成人99久久| 91精品国产日韩91久久久久久| 午夜成人免费电影| 欧美疯狂性受xxxxx喷水图片| 亚洲国产精品久久艾草纯爱 | 在线亚洲高清视频| 亚洲综合清纯丝袜自拍| 97精品久久久午夜一区二区三区| 美腿丝袜亚洲色图| 亚洲激情网站免费观看| 中文字幕一区三区| 国产亚洲精品免费| 欧美巨大另类极品videosbest | 九色porny丨国产精品| 亚洲一区在线观看免费观看电影高清| 国产精品美女久久久久久久久| 中文字幕一区二区三区色视频 | 国产精品国产精品国产专区不蜜| 国产精品免费视频观看| 亚洲激情图片一区| 日韩中文字幕一区二区三区| 视频一区二区中文字幕| 精品一区二区三区在线播放视频| 国产成人日日夜夜| 成人影视亚洲图片在线| 国产露脸91国语对白| 99精品视频在线观看免费| 精品久久久久久亚洲综合网 | 亚洲一区二区在线视频| 韩国av一区二区| 欧美性感一区二区三区| 精品久久久久香蕉网| 洋洋成人永久网站入口| 国产成人在线看| 国产激情一区二区三区桃花岛亚洲| 国产成人精品免费网站| 欧美美女bb生活片| 中文一区在线播放| 国产精品伊人色| 日韩一卡二卡三卡| 亚洲地区一二三色| 成人少妇影院yyyy| 久久综合色婷婷| 青青草原综合久久大伊人精品优势| 成人精品小蝌蚪| 国产91精品在线观看| 51精品秘密在线观看| 亚洲在线观看免费| 色欧美乱欧美15图片| 亚洲欧洲99久久| 色呦呦国产精品| 亚洲欧洲韩国日本视频| 东方aⅴ免费观看久久av| 欧美变态口味重另类| 人人狠狠综合久久亚洲| 欧美年轻男男videosbes| 亚洲人精品午夜| 成人免费在线播放视频| 免费观看久久久4p| 欧美一区二区精品久久911| 亚洲黄色录像片| 中文字幕一区av| 亚洲在线一区二区三区| 久久精品国产精品青草| 日韩欧美电影一区| 视频一区二区三区在线| 久久综合九色综合97婷婷女人| 国内精品嫩模私拍在线| 欧美老肥妇做.爰bbww视频| 国产一区二区三区蝌蚪| 亚洲免费毛片网站| 日韩欧美国产高清| 欧美综合一区二区| a级高清视频欧美日韩| 日韩va欧美va亚洲va久久| 欧美日韩国产片| 成人综合日日夜夜| 日日夜夜免费精品| 一区二区三区在线视频观看| 久久亚洲综合色| 欧美一级欧美三级| 91官网在线免费观看| 91日韩一区二区三区| 国产乱理伦片在线观看夜一区| 日本不卡的三区四区五区| 亚洲精品菠萝久久久久久久| 国产日韩亚洲欧美综合|