www.pudn.com > Bit1611_demo_code.rar > MAIN.C


/* ********************************************************************** 
 
         Copyright (c) 2002-2006 Beyond Innovation Technology Co., Ltd 
 
         All rights are reserved. Reproduction in whole or in parts is 
    prohibited without the prior written consent of the copyright owner. 
   ---------------------------------------------------------------------- 
 
    Module: MAIN.C 
 
    Purpose: Implementation of MAIN module. 
 
    Version: 0.01                                   11:26AM  2005/11/17 
 
    Compiler: Keil 8051 C Compiler v8.01 
 
    Reference: 
 
   ---------------------------------------------------------------------- 
    Modification: 
 
    R0.01 11:26AM  2005/11/17 Jeffrey Chang 
    Reason: 
        1. Original. 
    Solution: 
 
    ********************************************************************** */ 
 
#define _MAIN_C_ 
 
 
/* ------------------------------------ 
    Header Files 
   ------------------------------------ */ 
#include "bitek.h" 
#include "dispatch.h" 
#include "key.h" 
#include "main.h" 
#include "mcu.h" 
#include "menu.h" 
#include "platform.h" 
#include "por.h" 
#include "timer.h" 
#include "vp.h" 
#include "yuv.h" 
 
#if (IR_CFG != IR_00_UNUSE) 
    #include "ir.h" 
#endif 
 
 
/* ------------------------------------ 
    Macro Definitions 
   ------------------------------------ */ 
 
/* ------------------------------------ 
    Type Definitions 
   ------------------------------------ */ 
 
/* ------------------------------------ 
    Variables Definitions 
   ------------------------------------ */ 
 
 
/* ------------------------------------ 
    Function Prototypes 
   ------------------------------------ */ 
 
/* ------------------------------------------------------------------- 
    Name: main - 
    Purpose: 
    Passed: None. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void main (void) 
{ 
    /* Power-On Reset */ 
    POR_Init(); 
 
 
    for (;;) 
    { 
        if (KEY_Hit()) 
            DISPATCH_Go(); 
 
        if ((bSystemState != SYSTEM_POWER_OFF)      && 
            (bSystemState != SYSTEM_BURN_IN_MENU)       ) 
        { 
            #if (YUV_GO_POOLING) 
            if (fYUV_Go_Pooling) 
                YUV_Go(); 
            #else 
            YUV_Go(); 
            #endif 
 
            // AUTO MENU off ! 
            if (wMENU_Tick                          && 
                (wMENU_Tick < MENU_AUTO_OFF_SLOT)       ) 
            { 
                MENU_EnableMenu(MENU_ALL, OFF); 
 
                bSystemState = SYSTEM_POWER_ON; 
                wMENU_Tick = 0; 
            } 
 
 
            /* :::::::::::::::::::::::::::::::::::: 
                VR Adjustment ! 
               :::::::::::::::::::::::::::::::::::: */ 
            #if (KEY_VR_AIN21) 
            if (bKEY_VR_ADJUSTMENT == 0) 
            { 
                UB8 b19C; 
 
 
                b19C = BITEK_RxByte(YUV_MAD, VP_19C_ADC2); 
                if (b19C != tsEYD.bBrightness) 
                { 
                    tsEYD.bBrightness = b19C; 
 
                    // To clear Sub Menu 
                    MENU_ClearMenu(MENU_SUBMENU); 
 
                    DISPATCH_BrightnessMenu(); 
 
                    // To show Sub Menu 
                    MENU_EnableMenu(MENU_SUBMENU, ON); 
 
                    // To adjust VD 
                    YUV_SetBrightness(tsEYD.bBrightness); 
 
                    // To backup 
                    EEPROM_TxBurst(EYD_ADDR_BRIGHTNESS, 
                                   sizeof(tsEYD.bBrightness), 
                                   (UB8 *)&tsEYD.bBrightness    ); 
                } 
 
                bKEY_VR_ADJUSTMENT = KEY_VR_DEFAULT; 
            } 
            #endif 
        } 
 
 
        /* :::::::::::::::::::::::::::::::::::: 
            IR module ! 
           :::::::::::::::::::::::::::::::::::: */ 
        #if (IR_HW_CFG == IR_HW_MCU)        ||  \ 
            (IR_HW_CFG == IR_HW_BIT1611B) 
 
        if (fIR_CodeReady) 
        { 
            IR_ProcessCode(); 
 
            fIR_CodeReady = FALSE; 
        } 
 
        #endif 
 
 
    } /* for endless loop */ 
} /* main */ 
 
/* ------------------------------------------------------------------- 
    Name:  - 
    Purpose: . 
    Passed: None. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
 
/* ********************************************************************** 
 
    Description: 
 
 
   ********************************************************************** */ 
 
/* %% End Of File %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */