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

📄 lcd_osd_rel.c

📁 keil c51平台,此代码可用于学习TFT LCD 之TCON,SCALER,OSD,(本人自己修改)
💻 C
📖 第 1 页 / 共 5 页
字号:
        OSD_Line(10 - ucTemp, 2, 24, 0x00, 1);     // Display
        OSD_Window(3, ucTemp + 1, 9 - ucTemp, 2, 25,
            OSD_WINDOW_ENABLE | OSD_WINDOW_SHADOWING, COLOR_CYAN);  // Main OSD window

        Wait_For_Event(EVENT_DEN_STOP);     // Wait for Frame End
    }

    OSD_Line(5, 2, 24, 0x00, 0);    // Attribute
    OSD_Line(5, 2, 24, 0x00, 1);    // Display

    for (ucTemp = 0; ucTemp < 12; ucTemp += 2)
    {
        OSD_Window(3, 5, 5, ucTemp + 3, 23 - ucTemp,
            OSD_WINDOW_ENABLE | OSD_WINDOW_SHADOWING, COLOR_CYAN);

        Wait_For_Event(EVENT_DEN_STOP);     // Wait for Frame End
    }

#endif
}

void Show_Mode(void)
{
    OSD_Line(11, 2, 24, 0x00, 1);       // Clear old characters

    switch (ucMode_Curr)
    {    
    case MODE_NOSIGNAL:     // NO SIGNAL

        OSD_Line(11, 2, 24, CHINESE == (stGUD1.FUNCTION & 0x07) ? 0x80 | COLOR_BLUE : COLOR_BLUE, 0);

        if ((SOURCE_VGA == (stGUD1.INPUT_SOURCE & 0x07)) && (VGA_ONLINE != bVGA_CONNECT))
            RTDCodeW((unsigned char *)OSD_HINT_TABLE[0][stGUD1.FUNCTION & 0x07]);
        else
            RTDCodeW((unsigned char *)OSD_HINT_TABLE[1][stGUD1.FUNCTION & 0x07]);
        break;

    case MODE_UNDEFINED0:
    case MODE_UNDEFINED1:
    case MODE_NOSUPPORT:

        OSD_Line(11, 2, 24, CHINESE == (stGUD1.FUNCTION & 0x07) ? 0x80 | COLOR_BLUE : COLOR_BLUE, 0);

        RTDCodeW((unsigned char *)OSD_HINT_TABLE[2][stGUD1.FUNCTION & 0x07]);
        break;

    case MODE_VIDEO60HZ:    // NTSC 60HZ
        OSD_Line(11, 2, 24, COLOR_BLUE, 0);     // Set characters to blue
        RTDCodeW(Remark_Mode);
        switch(ucAV_Mode)
        {
        case 0x01:  RTDCodeW(Remark_V60_0); break;
        case 0x11:  RTDCodeW(Remark_V60_1); break;
        case 0x21:  RTDCodeW(Remark_V60_2); break;
        case 0x31:  RTDCodeW(Remark_V60_3); break;
        case 0x41:  RTDCodeW(Remark_V60_4); break;
        }
        break;
    case MODE_VIDEO50HZ:    // PAL 50HZ
        OSD_Line(11, 2, 24, COLOR_BLUE, 0);     // Set characters to blue
        RTDCodeW(Remark_Mode);
        switch(ucAV_Mode)
        {   
        case 0x02:  RTDCodeW(Remark_V50_0); break;
        case 0x12:  RTDCodeW(Remark_V50_1); break;
        case 0x22:  RTDCodeW(Remark_V50_2); break;
        case 0x32:  RTDCodeW(Remark_V50_3); break;
        case 0x03:  RTDCodeW(Remark_V50_5); break;
        }
        break;

    case MODE_YUV60HZ:
    case MODE_YUV50HZ:
        break;

    default :
        OSD_Line(11, 2, 24, COLOR_BLUE, 0);     // Set characters to blue
        {
            unsigned int    usHwid;
            unsigned char   ucTemp;

            usHwid  = usIPH_ACT_WID;

            if (SOURCE_VGA == (stGUD1.INPUT_SOURCE & 0x07))
            {
                if (MODE_1600x1200x60HZ == ucMode_Curr)
                {
                    usHwid  = 1600;
                }
                else 
                {
                    if (MODE_1600x1200x60HZ > ucMode_Curr)
                    {
                        if (MODE_1280x0960x60HZ <= ucMode_Curr)
                            usHwid  = 1280;
                        else if (MODE_1152x0864x75HZ <= ucMode_Curr)
                            usHwid  = 1152;
                    }
                    else
                    {
                        if (MODE_USER1600x1200 == ucMode_Curr)
                            usHwid  = 1600;
                        else if (MODE_USER1280x960 <= ucMode_Curr)
                            usHwid  = 1280;
                        else if (MODE_USER1152x864 <= ucMode_Curr)
                            usHwid  = 1152;
                    }
                }
            }

            RTDCodeW(Remark_Mode);

            Data[0] = 12;
            Data[1] = N_INC;
            Data[2] = OSD_DATA_92;

            ucTemp  = usHwid / 100;

            if (10 <= ucTemp)
            {
                Data[3] = _1_;
                Data[4] = ucTemp - 10 + _0_;
            }
            else
            {
                Data[3] = 0;
                Data[4] = ucTemp + _0_;
            }

            ucTemp  = usHwid - ((unsigned int)100 * ucTemp);
        
            Data[5] = ucTemp / 10;
            Data[6] = ucTemp - (10 * Data[5]) + _0_;
            Data[5] = Data[5] + _0_;
            Data[7] = _X_;

            ucTemp      = usIPV_ACT_LEN / 100;
            Data[12]    = usIPV_ACT_LEN - ((unsigned int)100 * ucTemp);

            if (10 <= ucTemp)
            {
                Data[8]     = _1_;
                Data[9]     = ucTemp - 10 + _0_;
                Data[10]    = Data[12] / 10;
                Data[11]    = Data[12] - (10 * Data[10]) + _0_;
                Data[10]    = Data[10] + _0_;
            }
            else
            {
                Data[8]     = ucTemp + _0_;
                Data[9]     = Data[12] / 10;
                Data[10]    = Data[12] - (10 * Data[9]) + _0_;
                Data[9]     = Data[9] + _0_;
                Data[11]    = 0;
            }
            Data[12]    = 0;
            RTDWrite(Data);

            // Show Refresh Rate
            RTDCodeW(Remark_Rate);

            Data[0] = 7;
            Data[1] = N_INC;
            Data[2] = OSD_DATA_92;
            Data[3] = ucRefresh / 10;
            Data[4] = ucRefresh - (Data[3] * 10) + _0_;
            Data[3] = Data[3] + _0_;
            Data[5] = _H_;
            Data[6] = _Z_;
            Data[7] = 0;
            RTDWrite(Data);
        }
        break;
    }
}   

void Show_Note(void)
{
    RTDSetByte(HOSTCTRL_02, 0x40);  // Wake RTD up
    RTDCodeW(OSD_Reset);

    Get_OSD_Margin();

    Data[8]     = Data[2];
    Data[9]     = Data[0] + 2;

    Data[0]     = 5;
    Data[1]     = Y_INC;
    Data[2]     = OSD_ROW_90;
    Data[3]     = 0xaf;
    Data[4]     = 0x0c;
    Data[5]     = 5;
    Data[6]     = N_INC;
    Data[7]     = OSD_DATA_92;

    Data[10]    = 0;
    RTDWrite(Data);

    // When input format changed, OSD will be cleared by Detect_VGA_Mode() and Detect_AV_Mode()
    switch (stGUD1.INPUT_SOURCE & 0x07)
    {             
#if (VIDEO_CHIP != VDC_NONE || TMDS_ENABLE == 1)
    case SOURCE_VGA:
        RTDCodeW(OSD_RGB);  // OSD RGB note
        break;
    case SOURCE_DVI:
        RTDCodeW(OSD_DVI);  // OSD DVI note
        break;
#endif

#if (VIDEO_CHIP != VDC_NONE)
    case SOURCE_AV:
        RTDCodeW(OSD_AV);   // OSD AV note
        break;
    case SOURCE_SV:
        RTDCodeW(OSD_SV);   // OSD S-Video note
        break;
    case SOURCE_YUV:
        RTDCodeW(OSD_YUV);  // OSD YUV note
        break;
    case SOURCE_TV:
        RTDCodeW(OSD_TV);
        break;
#endif
    default :
    	break;
    }
    RTDCodeW(OSD_Enable);

#if(IRPOLLING)
    usOSD_Timer	= (unsigned int)stGUD1.OSD_TIMEOUT * 34;
#else
    usOSD_Timer	= (unsigned int)stGUD1.OSD_TIMEOUT * 51;
#endif

}

void Show_Hint(void)
{
    if (MODE_NOSIGNAL == ucMode_Curr)
    {
        RTDSetByte(HOSTCTRL_02, 0x40);  // Wake RTD up
        RTDCodeW(OSD_Reset);

        if ((SOURCE_VGA == (stGUD1.INPUT_SOURCE & 0x07)) && (VGA_ONLINE != bVGA_CONNECT))
        {           
            RTDCodeW((unsigned char *)OSD_HINT_TABLE[0][stGUD1.FUNCTION & 0x07]);
        }
        else
        {
            RTDCodeW((unsigned char *)OSD_HINT_TABLE[1][stGUD1.FUNCTION & 0x07]);
        }

        RTDCodeW(OSD_Enable);
    }
    else if (MODE_NOSUPPORT == ucMode_Curr)
    {
        RTDSetByte(HOSTCTRL_02, 0x40);  // Wake RTD up
        RTDCodeW(OSD_Reset);

        RTDCodeW((unsigned char *)OSD_HINT_TABLE[2][stGUD1.FUNCTION & 0x07]);

        RTDCodeW(OSD_Enable);
    }
}


void Init_Page(unsigned char index)
{
    OSD_Position();
    OSD_Clear(2, 10, 2, 24);

    OSD_Window(3, 0, 11, 2, 25, OSD_WINDOW_ENABLE | OSD_WINDOW_SHADOWING, COLOR_CYAN);  // Main OSD window

    RTDCodeW(OSD_Title_Atb);

    Data[0]     = 5;
    Data[1]     = Y_INC;
    Data[2]     = OSD_ROW_90;
    Data[3]     = 0xa0;
    Data[4]     = (index << 2) + 2;
    Data[5]     = 7;
    Data[6]     = N_INC;
    Data[7]     = OSD_DATA_92;
    Data[8]     = 0x0f;
    Data[9]     = 0x0f;
    Data[10]    = 0x0f;
    Data[11]    = 0x0f;
    Data[12]    = 0;
    RTDWrite(Data);

    RTDCodeW(OSD_Title_Icon);

    RTDCodeW(CHINESE == (stGUD1.FUNCTION & 0x07) ? OSD_Title_C_Atb : OSD_Title_E_Atb);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OSD Process Routine
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

// In all OSD main page process, you CANNOT call other main page process directly.
// You CAN only change ucOSD_Page_Index to indicate other main page.
// Main program will detect the change of ucOSD_Page_Index and send NOTIFY_SHOW to the new page.
// The only constraint is YOU CANNOT change ucOSD_Page_Index when receive NOTIFY_SHOW.
// p.s. You can call sub-page process directly.

// OSD_Proc0 handles messages when there is no OSD window on screen (ucOSD_Page_Index = 0)
void OSD_Proc0(unsigned char action)
{
    switch (action)
    {
    case NOTIFY_ENTER_KEY:
        if (MODE_NOSIGNAL == ucMode_Curr || MODE_NOSUPPORT == ucMode_Curr)  
        {   
            ucMode_Curr   = MODE_OSDFORCE;
            return;
        }    
        // Change to OSD Main Page 1 and Main Program will show it
        ucOSD_Page_Index    = 1;
        ucOSD_Item_Index0   = 0;
        ucOSD_Item_Index1   = 0;
        ucOSD_Item_Index2   = 0;
        fac_timer = 0;
        break;
    case NOTIFY_RIGHT_KEY :
    case NOTIFY_LEFT_KEY :  
    case NOTIFY_IR_RIGHT_KEY :
    case NOTIFY_IR_LEFT_KEY :
    case NOTIFY_IR_VOLINC :
    case NOTIFY_IR_VOLDEC :
        if (MODE_NOSIGNAL == ucMode_Curr || MODE_NOSUPPORT == ucMode_Curr)  
        {   
            ucMode_Curr   = MODE_OSDFORCE;
            return;
        }    
#if (AUDIO_TYPE != AUDIO_NONE)
        if ( ucOSD_Item_Index1 == 0 )
        {
            ucOSD_Item_Index1 = 1;
            stGUD3.VOLUME   &= 0x1f;
            RTDCodeW(OSD_Reset);            
            RTDCodeW(OSD_Enable);
            RTDCodeW((unsigned char *)OSD_Volume_TABLE[stGUD1.FUNCTION & 0x07]);
            OSD_Slider(3, 1, 20, 0x1f - stGUD3.VOLUME, 0x1f, 0x01);
        }
        else
        {
            if (NOTIFY_RIGHT_KEY == action || NOTIFY_IR_RIGHT_KEY == action || NOTIFY_IR_VOLINC == action)
            {
                if (0x00 == stGUD3.VOLUME)      break;
                stGUD3.VOLUME   = stGUD3.VOLUME - 1;
            }
            else
            {
                if (0x1f <= stGUD3.VOLUME)      break;
                stGUD3.VOLUME   = stGUD3.VOLUME + 1;
            }
            OSD_Slider(3, 1, 20, 0x1f - stGUD3.VOLUME, 0x1f, 0x01);
            SetVolume();
            Save_GUD3();
        }
#endif
        fac_timer = 0;
        break;
    case NOTIFY_LR_KEY :
        // Go to Hidden FACTORY Function Page
        if ( fac_timer < 150 )	fac_timer = fac_timer + 1;
        if (SOURCE_VGA == (stGUD1.INPUT_SOURCE & 0x07) && fac_timer >= 150)
        {
            ucOSD_Page_Index    = 8;
            ucOSD_Item_Index0   = 1;
            ucOSD_Item_Index1   = 0;
            ucOSD_Item_Index2   = 0;
            fac_timer = 0;
        }
        break;
    case NOTIFY_AUTO_KEY:
        if (MODE_NOSIGNAL == ucMode_Curr || MODE_NOSUPPORT == ucMode_Curr)  
        {   
            ucMode_Curr   = MODE_OSDFORCE;
            return;
        }    

⌨️ 快捷键说明

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