www.pudn.com > Bit1611_demo_code.rar > MENU.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: MENU.C 
 
    Purpose: Implementation of MENU. 
 
    Version: 0.01                                   11:07AM  2005/11/17 
 
    Compiler: Keil 8051 C Compiler v8.01 
 
    Reference: 
    [1] BIT1611B Data Sheet Version 1.0, 2005-11-10, 
        Beyond Innovation Technology 
    [2] MTV121 Super On-Screen-Display for LCD Monitor, Revision 5.0 
        06/29/1999 Myson Technology 
 
   ---------------------------------------------------------------------- 
    Modification: 
 
    R0.01 11:02AM  2005/11/17 Jeffrey Chang 
    Reason: 
        1. Original. 
    Solution: 
 
   ********************************************************************** */ 
 
#define _MENU_C_ 
 
/* ------------------------------------ 
    Header Files 
   ------------------------------------ */ 
#include "bitek.h" 
#include "eeprom.h" 
#include "intrins.h" 
#include "led.h" 
#include "menu.h" 
#include "osd.h" 
#include "platform.h" 
#include "timer.h" 
 
 
/* ------------------------------------ 
    Macro Definitions 
   ------------------------------------ */ 
 
/* ------------------------------------ 
    Type Definitions 
   ------------------------------------ */ 
 
 
/* ------------------------------------ 
    Variables Definitions 
   ------------------------------------ */ 
 
/* ------------------------------------ 
    Function Prototypes 
   ------------------------------------ */ 
 
#if (OSD_CFG == OSD_BIT1611B) 
 
/* ------------------------------------------------------------------- 
    Name: MENU_ClearMenu - (OSD_BIT1611B) 
    Purpose: To clear specified MENU. 
    Passed: 
        UB8 bMenu = menu identifier. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_ClearMenu (UB8 bMenu) 
{ 
    if (bMenu & MENU_MESSAGE) 
        OSD_FillCharCode(OSD_WINDOW1_BASE, OSD_WINDOW1_AREA, ' '); 
 
    if (bMenu & MENU_MAINMENU) 
        OSD_FillCharCode(OSD_WINDOW2_BASE, OSD_WINDOW2_AREA, ' '); 
 
    if (bMenu & MENU_SUBMENU) 
        OSD_FillCharCode(OSD_WINDOW3_BASE, OSD_WINDOW3_AREA, ' '); 
} /* MENU_ClearMenu */ 
 
 
/* ------------------------------------------------------------------- 
    Name: MENU_EnableMenu - (OSD_BIT1611B) 
    Purpose: To enable/disable MENUs. 
    Passed: 
 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_EnableMenu ( 
UB8     bMenu, 
BOOL    fOn 
) 
{ 
    if (bMenu & MENU_MAINMENU) 
        OSD_EnableWindow(OSD_MAINMENU, fOn); 
 
    if (bMenu & MENU_SUBMENU) 
        OSD_EnableWindow(OSD_SUBMENU, fOn); 
 
    if (bMenu & MENU_MESSAGE) 
        OSD_EnableWindow(OSD_MESSAGE, fOn); 
} /* MENU_EnableMenu */ 
 
 
/* ------------------------------------------------------------------- 
    Name: MENU_Init - (OSD_BIT1611B) 
    Purpose: To initialize MENU module. 
    Passed: None. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_Init (void) 
{ 
    bMenuBaseItem       = 0; 
    bMenuCurrentItem    = 0; 
    bMenuLastItem       = 0; 
 
    MENU_ShowMainMenuItem(bMenuBaseItem); 
    MENU_UpdateMainMenuCursor(bMenuBaseItem, bMenuLastItem, bMenuCurrentItem); 
} /* MENU_Init */ 
 
 
#if (MENU_SHOW_MAINMENUITEM) 
/* ------------------------------------------------------------------- 
    Name: MENU_ShowMainMenuItem - (OSD_BIT1611B) 
    Purpose: To show main menu items. 
    Passed: bBase 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_ShowMainMenuItem (UB8 bBase) 
{ 
    UB8     bIdx; 
 
 
    for (bIdx = 0; bIdx < OSD_MAINMENU_HEIGHT; bIdx++) 
    { 
        OSD_ShowMsg(MENU_MAINMENU, 
                    0, 
                    bIdx, 
                    apbMainMenu[ bBase + bIdx ]); 
    } 
} /* MENU_ShowMainMenuItem */ 
#endif 
 
 
#if (MENU_UPDATE_MAINMENUCURSOR) 
/* ------------------------------------------------------------------- 
    Name: MENU_UpdateMainMenuCursor - (OSD_BIT1611B) 
    Purpose: To update the main menu cursor item. 
    Passed: None. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_UpdateMainMenuCursor ( 
UB8 bBase, 
UB8 bLast, 
UB8 bCurrent 
) 
{ 
    OSD_FillCharAttr(OSD_WINDOW2_BASE + OSD_WINDOW2_WIDTH * (bLast - bBase), 
                     OSD_WINDOW2_WIDTH, 
                     OSD2_COLOR_NORMAL                                          ); 
 
    OSD_FillCharAttr(OSD_WINDOW2_BASE + OSD_WINDOW2_WIDTH * (bCurrent - bBase), 
                     OSD_WINDOW2_WIDTH, 
                     OSD2_COLOR_HILIGHT                                         ); 
} /* MENU_UpdateMainMenuCursor */ 
#endif 
 
 
#elif (OSD_CFG == OSD_MTV121) 
 
 
/* ------------------------------------------------------------------- 
    Name: MENU_ClearMenu - (OSD_MTV121) 
    Purpose: To clear specified MENU. 
    Passed: 
        UB8 bMenu = menu identifier. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_ClearMenu (UB8 bMenu) 
{ 
    if (bMenu & MENU_MAINMENU) 
        OSD_FillCharCode(OSD_WINDOW1_ROW_START, 
                         OSD_WINDOW1_COL_START, 
                         OSD_WINDOW1_HEIGHT, 
                         OSD_WINDOW1_WIDTH, 
                         OSD_00_SPACE           ); 
 
 
    if (bMenu & MENU_SUBMENU) 
        OSD_FillCharCode(OSD_WINDOW2_ROW_START, 
                         OSD_WINDOW2_COL_START, 
                         OSD_WINDOW2_HEIGHT, 
                         OSD_WINDOW2_WIDTH, 
                         OSD_00_SPACE           ); 
 
    if (bMenu & MENU_MESSAGE) 
        OSD_FillCharCode(OSD_WINDOW3_ROW_START, 
                         OSD_WINDOW3_COL_START, 
                         OSD_WINDOW3_HEIGHT, 
                         OSD_WINDOW3_WIDTH, 
                         OSD_00_SPACE           ); 
} /* MENU_ClearMenu */ 
 
 
/* ------------------------------------------------------------------- 
    Name: MENU_EnableMenu - (OSD_MTV121) 
    Purpose: To enable/disable MENUs. 
    Passed: 
 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_EnableMenu ( 
UB8     bMenu, 
BOOL    fOn 
) 
{ 
    if (bMenu & MENU_MAINMENU) 
        OSD_EnableWindow(OSD_MAINMENU, fOn); 
 
 
    if (bMenu & MENU_SUBMENU) 
        OSD_EnableWindow(OSD_SUBMENU, fOn); 
 
 
    if (bMenu & MENU_MESSAGE) 
        OSD_EnableWindow(OSD_MESSAGE, fOn); 
} /* MENU_EnableMenu */ 
 
 
/* ------------------------------------------------------------------- 
    Name: MENU_Init - (OSD_MTV121) 
    Purpose: To initialize MENU module. 
    Passed: None. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_Init (void) 
{ 
    bMenuBaseItem       = 0; 
    bMenuCurrentItem    = 0; 
    bMenuLastItem       = 0; 
 
    MENU_ShowMainMenuItem(bMenuBaseItem); 
    MENU_UpdateMainMenuCursor(bMenuBaseItem, bMenuLastItem, bMenuCurrentItem); 
} /* MENU_Init */ 
 
 
#if (MENU_SHOW_MAINMENUITEM) 
/* ------------------------------------------------------------------- 
    Name: MENU_ShowMainMenuItem - (OSD_MTV121) 
    Purpose: To show main menu items. 
    Passed: bBase 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_ShowMainMenuItem (UB8 bBase) 
{ 
    UB8     bIdx; 
 
 
    for (bIdx = 0; bIdx < OSD_MAINMENU_HEIGHT; bIdx++) 
    { 
        OSD_ShowMsg(MENU_MAINMENU, 
                    0, 
                    bIdx, 
                    apbMainMenu[ bBase + bIdx ]); 
    } 
} /* MENU_ShowMainMenuItem */ 
#endif 
 
 
#if (MENU_UPDATE_MAINMENUCURSOR) 
/* ------------------------------------------------------------------- 
    Name: MENU_UpdateMainMenuCursor - (OSD_MTV121) 
    Purpose: To update the main menu cursor item. 
    Passed: None. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void MENU_UpdateMainMenuCursor(UB8 bBase, UB8 bLast, UB8 bCurrent) 
{ 
    OSD_FillCharAttr(OSD_WINDOW2_ROW_START + (bLast - bBase), 
                     OSD_WINDOW2_COL_START, 
                     1, 
                     OSD_WINDOW2_WIDTH, 
                     OSD2_COLOR_NORMAL                          ); 
 
    OSD_FillCharAttr(OSD_WINDOW2_ROW_START + (bCurrent - bBase), 
                     OSD_WINDOW2_COL_START, 
                     1, 
                     OSD_WINDOW2_WIDTH, 
                     OSD2_COLOR_HILIGHT                         ); 
} /* MENU_UpdateMainMenuCursor */ 
#endif 
 
#else 
    #error MENU.C - Invalid OSD_CFG ! 
#endif 
 
 
/* ------------------------------------------------------------------- 
    Name:  - 
    Purpose: . 
    Passed: None. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
 
 
/* ********************************************************************** 
 
    Description: 
 
 
   ********************************************************************** */ 
 
/* %% End Of File %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */