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

📄 lcd_osd_rel.c

📁 keil c51平台,此代码可用于学习TFT LCD 之TCON,SCALER,OSD,(本人自己修改)
💻 C
📖 第 1 页 / 共 5 页
字号:
        if ( ucOSD_Page_Index == 0 ) 
	{
            if ( ucOSD_Item_Index1 == 0 ) 
            {
    	        RTDCodeW((unsigned char *)OSD_Autocfg_TABLE[stGUD1.FUNCTION & 0x07]);
                RTDCodeW(OSD_Enable);
                if (MODE_0640x0350x70HZ <= ucMode_Curr && MODE_0720x0400x70HZ >= ucMode_Curr)
                {
                    unsigned char ucResult;

                    stMUD.CLOCK = 128;

                    Set_H_Position();
                    Set_Clock();
                    Save_MUD(ucMode_Curr);

                    ucResult    = Auto_Phase();

                    if (ERROR_SUCCEED == ucResult)      ucResult    = Auto_Position();
                    if (ERROR_INPUT == ucResult)
                    {
                        ucMode_Curr = MODE_OSDFORCE;
                        return;
                    }
                }
                else
                {
                    if (ERROR_INPUT == Auto_Config())
                    {
                        ucMode_Curr = MODE_OSDFORCE;
                        return;
                    }
                }
            }
            else
            {
                ucOSD_Page_Index    = 0;
                ucOSD_Item_Index0   = 0;
                ucOSD_Item_Index1   = 0;
                ucOSD_Item_Index2   = 0;
            }	
        }
        RTDCodeW(OSD_Reset);
        fac_timer = 0;
	break;
    default :
        // We don't handle other messages
        fac_timer = 0;
        break;
    }
}


#define PAGE1_ITEM_NUM      4
#define PAGE1_ITEM_NONE     0
#define PAGE1_ITEM_CONTRAST 1
#define PAGE1_ITEM_BRIGHT   2
#define PAGE1_ITEM_GAMMA    3
#define PAGE1_ITEM_EXIT     4

void OSD_Proc1(unsigned char action)
{
    switch (action)
    {
    case NOTIFY_ENTER_KEY :
        if (0 == ucOSD_Item_Index0)
        {
            if (MODE_NOSIGNAL != ucMode_Curr && MODE_NOSUPPORT != ucMode_Curr)
            {
                // Select and highlight the first item
                ucOSD_Item_Index0   = PAGE1_ITEM_CONTRAST;
                ucOSD_Item_Index1   = 0;
                OSD_Window(1, (2 + ucOSD_Item_Index0), (2 + ucOSD_Item_Index0), 7, 23, 7, COLOR_CYAN);
            }
        }
        else
        {
            if (ucOSD_Item_Index1 && (ucOSD_Item_Index0 != 3))
            {
                ucOSD_Item_Index1   = 0;    // Leave the item
                Show_Mode();
            }
            else
            {
                if (PAGE1_ITEM_EXIT == ucOSD_Item_Index0)
                {
                    // De-select the page item and disable the hightlight window
                    ucOSD_Item_Index0   = 0;
                    ucOSD_Item_Index1   = 0;
                    
                    // Disable highlight window
                    OSD_Window(1, (2 + PAGE1_ITEM_EXIT), (2 + PAGE1_ITEM_EXIT), 7, 23, 3, COLOR_CYAN);
                }
                else if (MODE_NOSIGNAL != ucMode_Curr && MODE_NOSUPPORT != ucMode_Curr)
                {
                    switch (ucOSD_Item_Index0)
                    {
                    case PAGE1_ITEM_CONTRAST :
                        ucOSD_Item_Index1   = 1;
                        OSD_Slider(11, 2, 20, stGUD0.CONTRAST, 100, 0x61);
                        break;
                    case PAGE1_ITEM_BRIGHT :
                        ucOSD_Item_Index1   = 1;
#if (BRIGHT_TYPE == GAIN)
                        OSD_Slider(11, 2, 20, stGUD0.BRIGHT, 100, 0x61);
#endif
#if (BRIGHT_TYPE == LIGHT)
                        OSD_Slider(11, 2, 20, fac_light, 100, 0x61);
#endif
                        break;
                    case PAGE1_ITEM_GAMMA :
                    	ucOSD_Item_Index1   = 1;
                        if(ucOSD_Item_Index2==0)
                            ucOSD_Item_Index2 = 3 - ((stGUD1.INPUT_SOURCE & 0x18) >>3);
                        RTDCodeW((3 == ucOSD_Item_Index2) ? OSD_Temp_2 
                            : (2 == ucOSD_Item_Index2) ? OSD_Temp_1 : OSD_Temp_0);
                        switch (ucOSD_Item_Index2)
                        {
                        case 1 :	//6500
                            stGUD1.INPUT_SOURCE = ( stGUD1.INPUT_SOURCE & 0xe7) | 0x10;
                            Set_Bright_Contrast();
                            Save_GUD0();
                            Save_GUD1();                            
                            break;
                        case 2 :	//7800
                            stGUD1.INPUT_SOURCE = ( stGUD1.INPUT_SOURCE & 0xe7) | 0x08;
                            Set_Bright_Contrast();
                            Save_GUD0();
                            Save_GUD1();                            
                            break;
                        case 3 :	//9300
                            stGUD1.INPUT_SOURCE = ( stGUD1.INPUT_SOURCE & 0xe7) | 0x00;
                            Set_Bright_Contrast();
                            Save_GUD0();
                            Save_GUD1();                            
                            break;                                                            
                        case 4 :
                            ucOSD_Item_Index0   = 3;
                            ucOSD_Item_Index1   = 0;
                            ucOSD_Item_Index2   = 0;
                            Show_Mode();
                            break;                        
                        }
                        break;
                    }
                }
            }
        }
        break;

    case NOTIFY_RIGHT_KEY :     // Right-key to Increase; Left-key to Decrease
    case NOTIFY_LEFT_KEY :
    case NOTIFY_IR_RIGHT_KEY :
    case NOTIFY_IR_LEFT_KEY :
        if (ucOSD_Item_Index1)
        {
            switch (ucOSD_Item_Index0)
            {
            case PAGE1_ITEM_CONTRAST :
                if (NOTIFY_RIGHT_KEY == action || NOTIFY_IR_RIGHT_KEY == action)
                {
                    if (100 <= stGUD0.CONTRAST)     break;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        stGUD0.CONTRAST   = 100 > stGUD0.CONTRAST ? stGUD0.CONTRAST + 1 : 100;
                    else
                        stGUD0.CONTRAST   = 99 > stGUD0.CONTRAST ? stGUD0.CONTRAST + 2 : 100;
                }
                else
                {
                    if (0 == stGUD0.CONTRAST)       break;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        stGUD0.CONTRAST   = 0 < stGUD0.CONTRAST ? stGUD0.CONTRAST - 1 : 0;
                    else
                        stGUD0.CONTRAST   = 1 < stGUD0.CONTRAST ? stGUD0.CONTRAST - 2 : 0;
                }
                OSD_Slider(11, 2, 20, stGUD0.CONTRAST, 100, 0x61);
                Set_Bright_Contrast();
                Save_GUD0();
                break;
            case PAGE1_ITEM_BRIGHT :

#if (BRIGHT_TYPE == GAIN)
                if (NOTIFY_RIGHT_KEY == action || NOTIFY_IR_RIGHT_KEY == action)
                {
                    if (100 <= stGUD0.BRIGHT)       break;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        stGUD0.BRIGHT   = 100 > stGUD0.BRIGHT ? stGUD0.BRIGHT + 1 : 100;
                    else
                        stGUD0.BRIGHT   = 99 > stGUD0.BRIGHT ? stGUD0.BRIGHT + 2 : 100;
                }
                else
                {
                    if (0 == stGUD0.BRIGHT)         break;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        stGUD0.BRIGHT   = 0 < stGUD0.BRIGHT ? stGUD0.BRIGHT - 1 : 0;
                    else
                        stGUD0.BRIGHT   = 1 < stGUD0.BRIGHT ? stGUD0.BRIGHT - 2 : 0;
                }
                OSD_Slider(11, 2, 20, stGUD0.BRIGHT, 100, 0x61);
#endif
#if (BRIGHT_TYPE == LIGHT)
                if (NOTIFY_RIGHT_KEY == action || NOTIFY_IR_RIGHT_KEY == action)
                {
                    if (100 <= fac_light)       break;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        fac_light   = 100 > fac_light ? fac_light + 1 : 100;
                    else
                        fac_light   = 99 > fac_light ? fac_light + 2 : 100;
                }
                else
                {
                    if (0 == fac_light)         break;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        fac_light   = 0 < fac_light ? fac_light - 1 : 0;
                    else
                        fac_light   = 1 < fac_light ? fac_light - 2 : 0;
                }
                OSD_Slider(11, 2, 20, fac_light, 100, 0x61);
#endif

                Set_Bright_Contrast();
                Save_GUD0();
                Save_GUD4();                
                break;

            case PAGE1_ITEM_GAMMA :
                if (NOTIFY_RIGHT_KEY == action || NOTIFY_IR_RIGHT_KEY == action)
                {
                    if (4 <= ucOSD_Item_Index2)     break;

                    ucOSD_Item_Index2   = ucOSD_Item_Index2 + 1;
                }
                else
                {
                    if (1 >= ucOSD_Item_Index2)     break;

                    ucOSD_Item_Index2   = ucOSD_Item_Index2 - 1;
                }

                RTDCodeW((4 == ucOSD_Item_Index2) ? OSD_Temp_3 
                    : (3 == ucOSD_Item_Index2) ? OSD_Temp_2 
                    : (2 == ucOSD_Item_Index2) ? OSD_Temp_1 : OSD_Temp_0);

                break;
            }
        }
        else
        {
            if (ucOSD_Item_Index0)
            {
                // Select and highlight the next/previous item
                if (NOTIFY_RIGHT_KEY == action || NOTIFY_IR_RIGHT_KEY == action)
                    ucOSD_Item_Index0   = (PAGE1_ITEM_NUM == ucOSD_Item_Index0) ? 1 : (ucOSD_Item_Index0 + 1);
                else
                    ucOSD_Item_Index0   = (1 == ucOSD_Item_Index0) ? PAGE1_ITEM_NUM : (ucOSD_Item_Index0 - 1);
                
                OSD_Window(1, (2 + ucOSD_Item_Index0), (2 + ucOSD_Item_Index0), 7, 23, 7, COLOR_CYAN);
            }
            else
            {
                // Change to next/previous main page
                if (NOTIFY_RIGHT_KEY == action || NOTIFY_IR_RIGHT_KEY == action)
                    ucOSD_Page_Index    = GetNextPageIdx(ucOSD_Page_Index);
                else
                    ucOSD_Page_Index    = GetPrevPageIdx(ucOSD_Page_Index);
            }
        }
        break;

    case NOTIFY_SHOW :
        Init_Page(0);
        RTDCodeW(CHINESE == (stGUD1.FUNCTION & 0x07) ? Page1_C_Atb : Page1_E_Atb);
        RTDCodeW((unsigned char *)OSD_PAGE_TABLE[0][stGUD1.FUNCTION & 0x07]);

        // Highlight the select item
        OSD_Window(1, (2 + ucOSD_Item_Index0), (2 + ucOSD_Item_Index0), 7, 23, (ucOSD_Item_Index0 ? 7 : 3), COLOR_CYAN);

        if (MODE_NOSIGNAL == ucMode_Curr || MODE_NOSUPPORT == ucMode_Curr)
        {
            ucOSD_Item_Index0   = 0;
            ucOSD_Item_Index1   = 0;
        }

        if (0 == ucOSD_Item_Index1)
            Show_Mode();                // No Slider on Page
        else
        {
            switch (ucOSD_Item_Index0)
            {
            case PAGE1_ITEM_CONTRAST :
                OSD_Slider(11, 2, 20, stGUD0.CONTRAST, 100, 0x61);
                break;
            case PAGE1_ITEM_BRIGHT :
#if (BRIGHT_TYPE == GAIN)
                OSD_Slider(11, 2, 20, stGUD0.BRIGHT, 100, 0x61);
#endif
#if (BRIGHT_TYPE == LIGHT)
                OSD_Slider(11, 2, 20, fac_light, 100, 0x61);
#endif
                break;
            case PAGE1_ITEM_GAMMA :
                ucOSD_Item_Index1   = ((stGUD1.INPUT_SOURCE >> 3) & 0x03) + 1;
                RTDCodeW((4 == ucOSD_Item_Index1) ? OSD_Temp_3 
                    : (3 == ucOSD_Item_Index1) ? OSD_Temp_2 
                    : (2 == ucOSD_Item_Index1) ? OSD_Temp_1 : OSD_Temp_0);
                break;
            }
        }
        break;

#if (KEY_TYPE == KEY_5)
    case NOTIFY_AUTO_KEY :
#endif

#if (KEY_TYPE == KEY_6)
    case NOTIFY_AUTO_KEY:
        RTDCodeW(OSD_Reset);
    	RTDCodeW((unsigned char *)OSD_Autocfg_TABLE[stGUD1.FUNCTION & 0x07]);
        RTDCodeW(OSD_Enable);
        if (MODE_0640x0350x70HZ <= ucMode_Curr && MODE_0720x0400x70HZ >= ucMode_Curr)
        {
            unsigned char ucResult;
            stMUD.CLOCK = 128;
            Set_H_Position();
            Set_Clock();
            Save_MUD(ucMode_Curr);
            ucResult    = Auto_Phase();
            if (ERROR_SUCCEED == ucResult)      ucResult    = Auto_Position();
            if (ERROR_INPUT == ucResult)
            {
                ucMode_Curr = MODE_OSDFORCE;
                return;
            }
        }
        else
        {
            if (ERROR_INPUT == Auto_Config())
            {
                ucMode_Curr = MODE_OSDFORCE;
                return;
            }
        }
	break;

    case NOTIFY_EXIT_KEY :
#endif    	
        if (0 == ucOSD_Item_Index1)
        {
            if (0 == ucOSD_Item_Index0)
            {
                ucOSD_Page_Index    = 0;
                RTDCodeW(OSD_Reset);            
            }
            else
            {
            	ucOSD_Item_Index0   = 0;
                OSD_Window(1, (2 + ucOSD_Item_Index0), (2 + ucOSD_Item_Index0), 7, 23, 3, COLOR_CYAN);
                Show_Mode();
            }    
        }
        else
        {
            ucOSD_Item_Index1   = 0;                
            Show_Mode();	
        }
        break;

    default :
        // We don't handle other messages
        break;
    }
}


#define PAGE2_ITEM_NUM      6
#define PAGE2_ITEM_NONE     0

⌨️ 快捷键说明

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