⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osdm.c

📁 keil C51 LCD 驱动源码,其中还有I2C驱动,ADC驱动,键盘操作等,是一个完整的keil源代码,供大家参考
💻 C
📖 第 1 页 / 共 4 页
字号:
/****************************************************************************
   +----------------------------------------------------------------------+
   | Copyright Trumpion Microelectronics Inc. 1999                        |
   | Trumpion Microelectronics Inc. reserves the right to change products |
   | or specifications without notice.                                    |
   +----------------------------------------------------------------------+
   Project    : LCD monitor
   Version    : 0.94
   File Name  : osdm.c
   Functions  : osd menu management routines
   Revision   :

   1999-05-18  OriginalTeam    First Created
   2000-07-17  Bill Tseng      Modified for Zurac-II
****************************************************************************/

//=========================================================================
// include files                                                          =
//=========================================================================
#include  "lib\extent.h"
#include  "lib\wreg516.h"
#include  "lib\declare.h"

#include  "lib\global.h"
#include  "lib\modedata.h"
#include  "lib\initial.h"
#include  "lib\ttfc.h"
#include  "lib\eeprom.h"
#include  "lib\osdmenu.h"
#include  "lib\hwmd.h"
#include        "LIB\MODEDET.H"
#include        "LIB\MISC.H"
#include  "LIB\OSDM.h"
#include  <math.h>

#define  MIDDLE          0x80

extern  Byte    RDATA   Test_text[];
extern  Byte    RDATA   Test_text1[];

extern  void    FreeRunInit(void);
extern  void    ShowScallWindow(Byte,Byte);
/*
void    OsdHandler(void);
void    OsdMenuFrame(void);
void    OsdEnable(Bool);
void    OsdClearAll(void);
void    OsdWindow(Byte num,Byte RDATA *owPtr);
// void    ShowCurSor(Byte Wnum,Byte RDATA *owPtr,Byte Item);
void    OsdDisableWindow(Byte);
void    OsdMenuItem(Byte);
void    OsdOpenUp(void);
void    OsdShowData(Byte,Byte,Byte);
void    OsdSetString(Byte RDATA *strptr,Byte items,Byte sel,Bool fgLang);
void    PrintString(Byte row,Byte col,Byte color,Byte RDATA *strptr);
void    PrintChar(Byte,Byte,Byte,Byte);
void    OsdClearRow(Byte,Byte,Byte);
void    OsdWrite(Byte,Byte);
void    OsdSetAddress(Byte,Byte);
void    OsdSetRowAttr(Byte,Byte,Byte);
void    OsdWriteChar(Byte,Byte);
void    OsdSelectPage(Byte);
void    OsdWriteControl(Byte addr,Byte RDATA *bptr,Byte count);
void    OsdColorFont(void);
void    OsdShowWindowA(void);
void    OsdShowWindowB(void);
void    OsdClearWinA(void);
void    OsdClearWinB(void);
void    OsdColorBar(Byte,Byte,Byte);
void    OutFacMenu();
*/
/************************************************************************
 * Function    : OsdHandler
 * Description : OSD Handler
 * Input       : none
 * Output      : none
 * Reference   : FgMenuChange
 *               OSDNumber
 ************************************************************************/
void    OsdHandler( void )
{
        switch( OSDNumber )
        {
                case L0_NOOSD :
                        OsdEnable( 0 );
                        break;
                case L0_MENU0 :
                case L0_MENU1 :
                case L0_MENU2 :
                case L0_MENU3 :
                case L0_MENU4 :
                case L0_MENU5 :
                case L0_MENU6 :
                        OsdMenuItem( OSDNumber );
                        OsdWindow( 1, OSDM_MAIN_WINDOW1 + (OSDPoint * 3));
                        OsdDisableWindow(2);
                        if(OSDNumber==L0_MENU5)
                                PrintChar(OSDLanguage+1,5,_RHAND,MAGENTA);  //TONNY
                        if(OSDNumber==L0_MENU3)
                                PrintChar(ColorTemp+1,5,_RHAND,MAGENTA);    //TONNY
                        if((OSDNumber==L0_MENU6)&&(FgFacMode==1))         //tonny
                //      if(OSDNumber==L0_MENU6)                           //tonny
                                PrintString(7, 5,BLACK,&OSDM_VERSION);
                        break;
                case L0_USERCOLOR :
                        OsdDisableWindow(1);            //algu 1113
                        OsdClearWinA();
                        OSDPoint=0;
                        PrintChar(2,3,_R,RED);
                        PrintChar(3,3,_G,GREEN);
                        PrintChar(4,3,_B,BLUE);
                //      PrintChar(2,24,0x21,RED);
                //      PrintChar(3,24,0x21,GREEN);
                //      PrintChar(4,24,0x21,BLUE);
                        OSDMinValue=0;
                        OSDMaxValue=100;
                        CurrentValue=ZRContrast;
                        OsdColorBar(2,6,RED);
                        CurrentValue=ZGContrast;
                        OsdColorBar(3,6,GREEN);
                        CurrentValue=ZBContrast;
                        OsdColorBar(4,6,BLUE);
                        break;
                case L0_FAC_MENU0 :
                        OutFacMenu();
                        OSDMinValue=0;
                        OSDMaxValue=255;
                        CurrentValue=U1RgainValue;
                        OsdColorBar(2,7,RED);
                        CurrentValue=U1GgainValue;
                        OsdColorBar(3,7,GREEN);
                        CurrentValue=U1BgainValue;
                        OsdColorBar(4,7,BLUE);
                        OSDMaxValue=127;                // 20011211
                        CurrentValue=M_BrightnessR;
                        OsdColorBar(5,7,RED);
                        CurrentValue=M_BrightnessG;
                        OsdColorBar(6,7,GREEN);
                        CurrentValue=M_BrightnessB;
                        OsdColorBar(7,7,BLUE);
                        break;
                case L0_FAC_MENU1 :
                        OutFacMenu();
                        OSDMinValue=0;
                        OSDMaxValue=100;
                        CurrentValue=ZRContrast;
                        OsdColorBar(2,7,RED);
                        CurrentValue=ZGContrast;
                        OsdColorBar(3,7,GREEN);
                        CurrentValue=ZBContrast;
                        OsdColorBar(4,7,BLUE);
                        OSDMaxValue=255;
                        CurrentValue=ZRBrightness;
                        OsdColorBar(5,7,RED);
                        CurrentValue=ZGBrightness;
                        OsdColorBar(6,7,GREEN);
                        CurrentValue=ZBBrightness;
                        OsdColorBar(7,7,BLUE);
                        break;
                case L0_FAC_MENU2 :
                        OutFacMenu();
                        if(DitherMode==3)
                                CurrentValue=4;
                        else
                                CurrentValue=DitherMode;
                        OsdShowData(2,13,RED);          //algu 1120 14->13
                        CurrentValue=GammaIndex;
                        OsdShowData(4,13,RED);          //algu 1120 14->13
                        CurrentValue=BrightnessValue;   //algu 1120  undo
                        OsdShowData(5,15,RED);          //algu 1120 undo
                //      OsdSetString(DOSModeText,2,(Byte)FgDosMode,0);
                //      PrintString(4,14,RED,DataPointer);
                        break;
                case L0_FAC_MENU3 :
                case L0_FAC_MENU4 :
                case L0_FAC_MENU5 :
                case L0_FAC_MENU6 :
                        OutFacMenu();
                        break;
    }
    if(FgMenuChange)
    {
         OsdOpenUp();    //OSD control register data
         FgMenuChange=0;
    }
}
/************************************************************************/
/************************************************************************/
void    OsdMenuFrame()
{
        Byte  i;

        OsdClearAll();
        OsdWindow( 4, OSDM_WINDOW4);            // Window 4
        OsdWindow( 5, OSDM_WINDOW5);            // Window 5
        OsdWindow( 6, OSDM_WINDOW6);            // Window 6

        OsdSetString(OSDM_RESOLUTION,TOTAL_MODE_NUMBER,ModeCounter,0);
        OsdSetRowAttr(0, 0x04, 0x14);   
        PrintString(0, 0,WHITE,DataPointer);    //algu 1109     col 1->0
        DataPointer=Test_text;
        PrintString(0, 18,WHITE,DataPointer);   //algu 1109     col 17->18
        i=HWMD_VFrequency()/100;
        PrintChar(0,22,OSDM_DEC_TABLE[(i/10)],WHITE);   //algu 1109     21->22
        PrintChar(0,23,OSDM_DEC_TABLE[(i%10)],WHITE);   //algu 1109     22->23
        i=HWMD_HFrequency()/100;
//      PrintChar(0,15,OSDM_DEC_TABLE[(i/10)],WHITE);
//      PrintChar(0,16,OSDM_DEC_TABLE[(i%10)],WHITE);
        PrintChar(0,18,OSDM_DEC_TABLE[(i/10)],WHITE);   //algu 1109     17->18
        PrintChar(0,19,OSDM_DEC_TABLE[(i%10)],WHITE);   //algu 1109     18->19
        if (FgBurnin==1)
        {
                PrintChar(0,15,_B,RED);
                PrintChar(0,16,_I,RED);
        }       
}
/************************************************************************/
void    OsdColorFont()
{
//      Byte    RDATA   colorfont[]={ 0xE8,0xEB,0xF4,0xF7,0xEE,0xF1,0xD0,0xD3,
//                                    0xD6,0xD9,0xE2,0xE5,0xDC,0xDF };
//algu 1119 move to osdmenu.c        Byte    RDATA   colorfont[]={ _COLOR_AUTO_L,_COLOR_AUTO_R,_COLOR_BRIGHTNESS_L,_COLOR_BRIGHTNESS_R,_COLOR_DISPLAY_L,_COLOR_DISPLAY_R,0xE2,0xE5,
//                                      0xD6,0xD9,0xEE,0xF1,0xF4,0xF7 };
//      Byte    RDATA   blackfont[]={ 0x76,0x77,0xB4,0xB5,0xB9,0xBA,0xBB,0xBC,
//                                      0x78,0x79,0x7A,0x7B,0x7C,0x7D };
        Byte    i;
        SlvAdr    = OSD_ADDRESS;
        ByteCnt   = 2;
        TrmBuf[0] = 0xCB;
        TrmBuf[1] = 0x30;
        SendData();
        if(!FgMenuPage)
                for(i=0;i<14;i++)
                {
                        PrintChar( i/2+1,1,colorfont[i],0x00);
                        PrintChar( i/2+1,2,colorfont[++i],0x00);
                }
        else
                for(i=0;i< 6;i++)
                {
                        PrintChar( i/2+1,1,blackfont[i],BLACK);         //algu 1112,  col 0->1
                        PrintChar( i/2+1,2,blackfont[++i],BLACK);       //algu 1112,  c0l 1->2
                }
        SlvAdr    = OSD_ADDRESS;
        ByteCnt   = 2;
        TrmBuf[0] = 0xCB;
        TrmBuf[1] = 0x20;
        SendData();
}
/************************************************************************/
/************************************************************************/
void    OsdMsgFrame(Byte number)
{
        OsdClearAll();
        OsdWindow( 6, OSDM_MSG_WINDOW6+number*3);    /* Window 6 */

}
/************************************************************************/
/************************************************************************/
void    OsdMenuItem(Byte number)
{
        Byte    i,j,omicount;

        j=5;
        OsdClearWinA();
        switch( number )
        {
                case L0_MENU0 :
                        omicount=OSDM_MENU0_ITEM;
                        OsdSetString(OSDM_MENU0,omicount,0,1);
                        break;
                case L0_MENU1 :
                        omicount=OSDM_MENU1_ITEM;
                        OsdSetString(OSDM_MENU1,omicount,0,1);
                        break;
                case L0_MENU2 :
                        omicount=OSDM_MENU2_ITEM;
                        OsdSetString(OSDM_MENU2,omicount,0,1);
                        if(!IsDOSMode())
                                omicount--;
                        break;
                case L0_MENU3 :
                        omicount=OSDM_MENU3_ITEM;
                        OsdSetString(OSDM_MENU3,omicount,0,1);
                        break;
                case L0_MENU4 :
                        omicount=OSDM_MENU4_ITEM;
                        OsdSetString(OSDM_MENU4,omicount,0,1);
                        break;
                case L0_MENU5 :
                        omicount=OSDM_MENU5_ITEM;
                        OsdSetString(OSDM_MENU5,omicount,0,0);
                        break;
                case L0_MENU6 :
                        omicount=OSDM_MENU6_ITEM;
                        OsdSetString(OSDM_MENU6,omicount,0,1);
                        break;
                case L0_FAC_MENU0 :
                        omicount=FAC_MENU0_ITEM;
                        OsdSetString(FAC_MENU0,omicount,0,0);
                        j=4;            //algu 1112,  3->4
                        break;
                case L0_FAC_MENU1 :
                        omicount=FAC_MENU1_ITEM;
                        OsdSetString(FAC_MENU1,omicount,0,0);
                        j=4;            //algu 1112,  3->4
                        break;
                case L0_FAC_MENU2 :
                        omicount=FAC_MENU2_ITEM;
                        OsdSetString(FAC_MENU2,omicount,0,0);
                        j=4;            //algu 1112,  3->4
                        break;
                case L0_FAC_MENU3 :
                case L0_FAC_MENU4 :
                case L0_FAC_MENU5 :
                case L0_FAC_MENU6 :
                        omicount = 0;
                        break;
                default :
                        omicount = 0;
                        break;
        };

        for( i=0; i<omicount; i++)
        {
           OsdSetRowAttr(i+1, 0x04, 0x14);
           if ( (number>=L0_FAC_MENU0) && (number<=L0_FAC_MENU6) )      //algu 1112
                PrintString(i+2,j,0x00,DataPointer);
           else 
                PrintString(i+1,j,0x00,DataPointer);
           while( *(DataPointer++)!=_EOF );  /* skip to next string */
        }
        
    
#if (INTERNALOSD)       //Check internal osd    algu 1204   
        
        if ( (number==L0_MENU2)&& (OSDLanguage==5) )    //Japanese
                InternalPrintChar(5,8,_INFONT_1,BLACK);
        else if ( (number==L0_MENU2)&& (OSDLanguage==6) )       //chinese   
        {
                InternalPrintChar(5,8,_INFONT_2,BLACK);
                InternalPrintChar(5,9,_INFONT_3,BLACK);
        }
        else if ( (number==L0_MENU3)&& (OSDLanguage==6) )       //chinese
        {
                InternalPrintChar(4,12,_INFONT_4,BLACK);
        //        InternalPrintChar(4,13,_INFONT_5,BLACK);   
        }                       

#endif          
        
}
/************************************************************************/
void    OsdShowMessage(Byte number)
{
       
        Byte    i;
//        OSDNumber=number;
//        a=number-L3_START-1;
        switch ( number )
        {
                //mutil language
                case AUTO_MESSAGE:
                case AUTOBALANCE_MESSAGE:
                        OsdMsgFrame(0);
                        OsdSetString(OSDM_MESSAGE,OSDM_MESSAGE_MUTIL_ITEM,number,1);    
                        PrintString(4,MIDDLE,WHITE,DataPointer);
                        break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -