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

📄 lcd_osd_rel.c

📁 keil c51平台,此代码可用于学习TFT LCD 之TCON,SCALER,OSD,(本人自己修改)
💻 C
📖 第 1 页 / 共 5 页
字号:
                            }
                        }
                        else
                        {
                            if (ERROR_INPUT == Auto_Config())
                            {
                                ucMode_Curr = MODE_OSDFORCE;
                                return;
                            }
                        }
                        break;
                    case PAGE3_ITEM_AUTOPOS :
                        if (ERROR_INPUT == Auto_Position())
                        {
                            ucMode_Curr = MODE_OSDFORCE;
                            return;
                        }

                        break;
                    case PAGE3_ITEM_AUTOPHA :
                        if (ERROR_INPUT == Auto_Phase())
                        {
                            ucMode_Curr = MODE_OSDFORCE;
                            return;
                        }
                        break;
                    case PAGE3_ITEM_AUTOCLK :
                        if (MODE_0640x0350x70HZ <= ucMode_Curr && MODE_0720x0400x70HZ >= ucMode_Curr)
                        {
                            stMUD.CLOCK = 128;

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

                            if (ERROR_INPUT == Auto_Position())
                            {
                                ucMode_Curr = MODE_OSDFORCE;
                                return;
                            }
                        }
                        else
                        {
                            if (ERROR_INPUT == Auto_Clock())
                            {
                                ucMode_Curr = MODE_OSDFORCE;
                                return;
                            }
                        }
                        break;
                    case PAGE3_ITEM_AUTOBAL :
                        if (ERROR_INPUT == Auto_Balance())
                        {
                            ucMode_Curr = MODE_OSDFORCE;
                            return;
                        }
                        break;
                    }
                }
                ucOSD_Item_Index1   = 0;    // Leave the item
                Show_Mode();
            }
            else
            {
                if (MODE_NOSIGNAL == ucMode_Curr || MODE_NOSUPPORT == ucMode_Curr)  break;

                ucOSD_Item_Index1   = 2;    // Enter the item, default NO
                RTDCodeW((unsigned char *)OSD_YESNO_TABLE[ucOSD_Item_Index1 - 1][stGUD1.FUNCTION & 0x07]);
            }
        }
        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)
        {
            ucOSD_Item_Index1   = (NOTIFY_LEFT_KEY == action) ? 1 : 2;
            RTDCodeW((unsigned char *)OSD_YESNO_TABLE[ucOSD_Item_Index1 - 1][stGUD1.FUNCTION & 0x07]);
        }
        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   = (PAGE3_ITEM_NUM == ucOSD_Item_Index0) ? 1 : (ucOSD_Item_Index0 + 1);
                else
                    ucOSD_Item_Index0   = (1 == ucOSD_Item_Index0) ? PAGE3_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(2);
        RTDCodeW(CHINESE == (stGUD1.FUNCTION & 0x07) ? Page3_C_Atb : Page3_E_Atb);
        RTDCodeW((unsigned char *)OSD_PAGE_TABLE[2][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 (ucOSD_Item_Index1)
            RTDCodeW((unsigned char *)OSD_YESNO_TABLE[ucOSD_Item_Index1 - 1][stGUD1.FUNCTION & 0x07]);
        else
            Show_Mode();
        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 PAGE4_ITEM_NUM      6
#define PAGE4_ITEM_NONE     0
#define PAGE4_ITEM_LANGUAGE 1
#define PAGE4_ITEM_OSDH     2
#define PAGE4_ITEM_OSDV     3
#define PAGE4_ITEM_TIMEOUT  4
#define PAGE4_ITEM_TRANSLU  5
#define PAGE4_ITEM_EXIT     6

#define PAGE4B_ITEM_NUM         6
#define PAGE4B_ITEM_NONE        0
#define PAGE4B_ITEM_CHINESE     1
#define PAGE4B_ITEM_ENGLISH     2
#define PAGE4B_ITEM_FRENCH      3
#define PAGE4B_ITEM_GERMAN      4
#define PAGE4B_ITEM_ITALIAN     5
#define PAGE4B_ITEM_SPANISH     6


void OSD_Proc4(unsigned char action)
{
    if (PAGE4_ITEM_LANGUAGE == ucOSD_Item_Index0 && 0 != ucOSD_Item_Index1)
    {
        if (NOTIFY_SHOW != action)
        {
            // When language setting sub-page is open, just re-direct the message to the sub-page process
            OSD_Proc4_B(action);
            
            if (ucOSD_Item_Index1)  return;     // Language Setting Sub-Page still in work
            
            action  = NOTIFY_SHOW;              // Redraw itself when returned from sub-page
        }
        else
        {
            // Quit language sub-page if signal changed.
            ucOSD_Item_Index1   = 0;
        }
    }

    switch (action)
    {
    case NOTIFY_ENTER_KEY :
        if (0 == ucOSD_Item_Index0)
        {
            // Select and highlight the first item
            ucOSD_Item_Index0   = PAGE4_ITEM_LANGUAGE;
            ucOSD_Item_Index1   = 0;
            OSD_Window(1, (2 + ucOSD_Item_Index0), (2 + ucOSD_Item_Index0), 7, 23, 7, COLOR_CYAN);
        }
        else
        {
            switch (ucOSD_Item_Index0)
            {
            case PAGE4_ITEM_LANGUAGE :
                ucOSD_Item_Index1   = (stGUD1.FUNCTION & 0x07) + 1;
                OSD_Proc4_B(NOTIFY_SHOW);       // Show the sub-page
                break;
            case PAGE4_ITEM_OSDH :
                if (ucOSD_Item_Index1)
                {
                    ucOSD_Item_Index1   = 0;    // Leave the item
                    Show_Mode();
                }
                else
                {
                    ucOSD_Item_Index1   = 1;    // Enter the item, show slider
                    Get_OSD_Margin();
                    OSD_Slider(11, 2, 20, stGUD1.OSD_POSH - Data[0], Data[1] - Data[0], 0x61);
                }
                break;
            case PAGE4_ITEM_OSDV :
                if (ucOSD_Item_Index1)
                {
                    ucOSD_Item_Index1   = 0;    // Leave the item
                    Show_Mode();
                }
                else
                {
                    ucOSD_Item_Index1   = 1;    // Enter the item, slider
                    Get_OSD_Margin();
                    OSD_Slider(11, 2, 20, stGUD1.OSD_POSV - Data[2], Data[3] - Data[2], 0x61);
                }
                break;
            case PAGE4_ITEM_TIMEOUT :
                if(ucOSD_Item_Index2)
                {
				    ucOSD_Item_Index2   = 0;
                    ucOSD_Item_Index1   = 0;    // Leave the item
                    Show_Mode();
                }
                else if (ucOSD_Item_Index1)
                {
                    /*
                    ucOSD_Item_Index1   = 0;    // Leave the item
                    Show_Mode();
                    */
			if(ucOSD_Item_Index1 == 2)
			{
			    ucOSD_Item_Index1 = 0;
		            Show_Mode();
			}
	 		else
			{
                            ucOSD_Item_Index2    = 1;
						
			    if(stGUD1.OSD_TIMEOUT < 5)
			    {
				   stGUD1.OSD_TIMEOUT = 10; //reset to 20 seconds
				   usOSD_Timer         = 510; //10*51     
				   Save_GUD1();
			    }
                        
                            OSD_Slider(11, 2, 20, stGUD1.OSD_TIMEOUT, 60, 0x61);
			}
                }
                else
                {
                    ucOSD_Item_Index1   = stGUD1.OSD_TIMEOUT ? 1 : 2;
                    RTDCodeW((unsigned char *)OSD_ONOFF_TABLE[ucOSD_Item_Index1 - 1][stGUD1.FUNCTION & 0x07]);
                }
                break;
            case PAGE4_ITEM_TRANSLU :
                if (ucOSD_Item_Index1)
                {
                    ucOSD_Item_Index1   = 0;    // Leave the item
                    Show_Mode();
                }
                else
                {
                    ucOSD_Item_Index1   = (stGUD1.FUNCTION & 0x10) ? 1 : 2;     // 1-On, 2-Off
                    RTDCodeW((unsigned char *)OSD_ONOFF_TABLE[ucOSD_Item_Index1 - 1][stGUD1.FUNCTION & 0x07]);
                }
                break;
            case PAGE4_ITEM_EXIT :
                // 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 + PAGE4_ITEM_EXIT), (2 + PAGE4_ITEM_EXIT), 7, 23, 3, COLOR_CYAN);
                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 PAGE4_ITEM_OSDH :
                Get_OSD_Margin();
                if (NOTIFY_RIGHT_KEY == action || NOTIFY_IR_RIGHT_KEY == action)
                {
                    if (Data[1] <= stGUD1.OSD_POSH)     break;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        stGUD1.OSD_POSH   = Data[1] > stGUD1.OSD_POSH ? stGUD1.OSD_POSH + 1 : Data[1];
                    else
                        stGUD1.OSD_POSH   = (Data[1] - 1) > stGUD1.OSD_POSH ? stGUD1.OSD_POSH + 2 : Data[1];
                }
                else
                {
                    if (Data[0] >= stGUD1.OSD_POSH)     break;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        stGUD1.OSD_POSH   = Data[0] < stGUD1.OSD_POSH ? stGUD1.OSD_POSH - 1 : Data[0];
                    else
                        stGUD1.OSD_POSH   = (Data[0] + 1) < stGUD1.OSD_POSH ? stGUD1.OSD_POSH - 2 : Data[0];
                }
                OSD_Slider(11, 2, 20, stGUD1.OSD_POSH - Data[0], Data[1] - Data[0], 0x61);
                OSD_Position();
                Save_GUD1();
                break;
            case PAGE4_ITEM_OSDV :
                Get_OSD_Margin();
                if (NOTIFY_RIGHT_KEY == action || NOTIFY_IR_RIGHT_KEY == action)
                {
                    if (Data[3] <= stGUD1.OSD_POSV)     break;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        stGUD1.OSD_POSV   = Data[3] > stGUD1.OSD_POSV ? stGUD1.OSD_POSV + 1 : Data[3];
                    else
                        stGUD1.OSD_POSV   = (Data[3] - 1) > stGUD1.OSD_POSV ? stGUD1.OSD_POSV + 2 : Data[3];
                }
                else
                {
                    if (Data[2] >= stGUD1.OSD_POSV)     break;

                 

⌨️ 快捷键说明

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