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

📄 lcd_osd_ktc.c

📁 keil c51平台,此代码可用于学习TFT LCD 之TCON,SCALER,OSD,(本人自己修改)
💻 C
📖 第 1 页 / 共 5 页
字号:
                            stGUD4.u_B   = 99 > stGUD4.u_B ? stGUD4.u_B + 2 : 100;
                    }
                    else
                    {
                        if (0 == stGUD4.u_B)     return;

                        if (KEY_TURBO_ENABLE > ucKey_Issued)
                            stGUD4.u_B   = 0 < stGUD4.u_B ? stGUD4.u_B - 1 : 0;
                        else
                            stGUD4.u_B   = 1 < stGUD4.u_B ? stGUD4.u_B - 2 : 0;
                    }
                    OSD_Slider(6, 4, 17, stGUD4.u_B, 100, 0x17);
                    Set_Bright_Contrast();
                    Save_GUD0();
                    Save_GUD4();                    
                    break;                    
                }
            }
            else
            {
                if (NOTIFY_RIGHT_KEY == action)
                    ucOSD_Item_Index1   = (4 == ucOSD_Item_Index1) ? 1 : (ucOSD_Item_Index1 + 1);
                else
                    ucOSD_Item_Index1   = (1 == ucOSD_Item_Index1) ? 4 : (ucOSD_Item_Index1 - 1);
                
                Show_Page2();                
            }        
        }
        else
        {
            if (NOTIFY_RIGHT_KEY == action)
                ucOSD_Item_Index0   = (PAGE2_ITEM_NUM == ucOSD_Item_Index0) ? 1 : (ucOSD_Item_Index0 + 1);
            else
                ucOSD_Item_Index0   = (1 == ucOSD_Item_Index0) ? PAGE2_ITEM_NUM : (ucOSD_Item_Index0 - 1);
                
            Show_Page2();
        }
        break;
        
#if (KEY_TYPE == KEY_5)            
    case NOTIFY_AUTO_KEY :
#endif 

#if (KEY_TYPE == KEY_6)            
    case NOTIFY_EXIT_KEY :
#endif     	
        if (ucOSD_Item_Index1)
        {
            if (ucOSD_Item_Index2)
            {
                ucOSD_Item_Index2   = 0;            
            }
            else
            {
                ucOSD_Item_Index0   = 4;
                ucOSD_Item_Index1   = 0;
                ucOSD_Item_Index2   = 0;
                RTDCodeW(OSD_Page2_Atb);
                RTDCodeW(OSD_Page2_User_Atb);
            }
            Show_Page2();
        }
        else
        {
            ucOSD_Page_Index    = 1;
            ucOSD_Item_Index0   = 9;
            ucOSD_Item_Index1   = 0;
            ucOSD_Item_Index2   = 0;
            RTDCodeW(OSD_Reset);
        } 
        	
        break;



    case NOTIFY_SHOW :
        OSD_Position();
        OSD_Clear(0, 12, 0, 29);
        RTDCodeW(OSD_Enable);
        Show_Page2();
        break;

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




#define PAGE3_ITEM_NUM     4
#define PAGE3_ITEM_NONE    0
#define PAGE3_ITEM_OSDH    1
#define PAGE3_ITEM_OSDV    2
#define PAGE3_ITEM_OSDE    3
#define PAGE3_ITEM_EXIT    4

void OSD_Proc3(unsigned char action)
{
    switch (action)
    {
    case NOTIFY_ENTER_KEY :
        if (ucOSD_Item_Index1)
        {
            ucOSD_Item_Index1 = 0;
        }
        else
        {
            if (PAGE3_ITEM_EXIT == ucOSD_Item_Index0)
            {
                ucOSD_Page_Index    = 1;
                ucOSD_Item_Index0   = 12;
                ucOSD_Item_Index1   = 0;
                ucOSD_Item_Index2   = 0;                
                return;
            }    
            else if (PAGE3_ITEM_OSDE == ucOSD_Item_Index0)
            {
                if (stGUD1.FUNCTION & 0x10)
                {
                    stGUD1.FUNCTION     = stGUD1.FUNCTION & 0xef ;
                }
                else
                {
                    stGUD1.FUNCTION     = stGUD1.FUNCTION | 0x10 ;                    
                }

#if (SWAP_RED_BLUE)
                RTDSetBit(OVL_CTRL_6D, 0x3f, (stGUD1.FUNCTION & 0x10) ? 0x90 : 0x10);
#else
                RTDSetBit(OVL_CTRL_6D, 0x3f, (stGUD1.FUNCTION & 0x10) ? 0x80 : 0x00);
#endif

                Save_GUD1();                
            }
            else
            {
            	ucOSD_Item_Index1 = 1;
            }
        }    
        
        Show_Page3();            
        break;

    case NOTIFY_RIGHT_KEY :     // Right-key to Increase; Left-key to Decrease
    case NOTIFY_LEFT_KEY :
        if (ucOSD_Item_Index1)
        {
            switch (ucOSD_Item_Index0)
            {
            case PAGE3_ITEM_OSDH:
                Get_OSD_Margin();
                if (NOTIFY_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(6, 3, 18, stGUD1.OSD_POSH - Data[0], Data[1] - Data[0], (1 == ucOSD_Item_Index1) ? 0x04:0x01);
                OSD_Position();
                Save_GUD1();                
                break;
            case PAGE3_ITEM_OSDV:
                Get_OSD_Margin();
                if (NOTIFY_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;

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        stGUD1.OSD_POSV   = Data[2] < stGUD1.OSD_POSV ? stGUD1.OSD_POSV - 1 : Data[2];
                    else
                        stGUD1.OSD_POSV   = (Data[2] + 1) < stGUD1.OSD_POSV ? stGUD1.OSD_POSV - 2 : Data[2];
                }
                OSD_Slider(6, 3, 18, stGUD1.OSD_POSV - Data[2], Data[3] - Data[2], (1 == ucOSD_Item_Index1) ? 0x04:0x01);
                OSD_Position();
                Save_GUD1();                
                break;            
            default:
                break;            
            }
        }
        else
        {
            if (NOTIFY_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);
                
            Show_Page3();            
        }        
        break;
        
#if (KEY_TYPE == KEY_5)        
    case NOTIFY_AUTO_KEY :
#endif 

#if (KEY_TYPE == KEY_6)         
    case NOTIFY_EXIT_KEY :
#endif    	
        if (ucOSD_Item_Index1)
        {
            ucOSD_Item_Index1 = 0;
            Show_Page3();
        }
        else
        {
            ucOSD_Page_Index    = 1;
            ucOSD_Item_Index0   = 12;
            ucOSD_Item_Index1   = 0;
            ucOSD_Item_Index2   = 0;                
        }
        break;
 


    case NOTIFY_SHOW :
        OSD_Position();
        OSD_Clear(0, 12, 0, 29);
        RTDCodeW(OSD_Enable);
        Show_Page3();
        break;

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


#define PAGE4_ITEM_NUM         6
#define PAGE4_ITEM_NONE        0
#define PAGE4_ITEM_CHINESE     1
#define PAGE4_ITEM_ENGLISH     2
#define PAGE4_ITEM_FRENCH      3
#define PAGE4_ITEM_GERMAN      4
#define PAGE4_ITEM_ITALIAN     5
#define PAGE4_ITEM_SPANISH     6

void OSD_Proc4(unsigned char action)
{
    switch (action)
    {
    case NOTIFY_ENTER_KEY :
        if ((stGUD1.FUNCTION & 0x07) != (ucOSD_Item_Index0 - 1))
        {
            stGUD1.FUNCTION = (stGUD1.FUNCTION & 0xf8) | ((ucOSD_Item_Index0 - 1) & 0x07);
            Save_GUD1();

            switch (stGUD1.FUNCTION & 0x07)
            {
            case PAGE4_ITEM_CHINESE :
                RTDCodeW(OSD_Reset);
                Load_Font(Font_East_C, 0x00, 0x12);
                ucOSD_Page_Index    = 1;
                ucOSD_Item_Index0   = 14;
                ucOSD_Item_Index1   = 0;
                ucOSD_Item_Index2   = 0;    
                break;
            default :
                ucOSD_Page_Index    = 1;
                ucOSD_Item_Index0   = 14;
                ucOSD_Item_Index1   = 0;
                ucOSD_Item_Index2   = 0;    
                break;
            }
        }
        break;

    case NOTIFY_RIGHT_KEY :     // Right-key to Increase; Left-key to Decrease
    case NOTIFY_LEFT_KEY :
        if (NOTIFY_RIGHT_KEY == action)
            ucOSD_Item_Index0   = (PAGE4_ITEM_NUM == ucOSD_Item_Index0) ? 1 : (ucOSD_Item_Index0 + 1);
        else
            ucOSD_Item_Index0   = (1 == ucOSD_Item_Index0) ? PAGE4_ITEM_NUM : (ucOSD_Item_Index0 - 1);
                
            Show_Page4();            
        break;
        
#if (KEY_TYPE == KEY_5)                 
    case NOTIFY_AUTO_KEY :
#endif 

#if (KEY_TYPE == KEY_6)                  
    case NOTIFY_EXIT_KEY :
#endif
            ucOSD_Page_Index    = 1;
            ucOSD_Item_Index0   = 14;
            ucOSD_Item_Index1   = 0;
            ucOSD_Item_Index2   = 0;     
        break;

    case NOTIFY_SHOW :
        OSD_Position();
        OSD_Clear(0, 12, 0, 29);
        RTDCodeW(OSD_Enable);
        Show_Page4();
        break;
 

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

#define PAGE8_ITEM_NUM         6
#define PAGE8_ITEM_NONE        0
#define PAGE8_ITEM_Bright      1
#define PAGE8_ITEM_Contrast    2
#define PAGE8_ITEM_Light       3
#define PAGE8_ITEM_Facmode     4
#define PAGE8_ITEM_Automode    5
#define PAGE8_ITEM_Exit        6

void OSD_Proc8(unsigned char action)
{
    switch (action)
    {
    case NOTIFY_ENTER_KEY :
        if (ucOSD_Item_Index1)
        {
            ucOSD_Item_Index1 = 0;
            Show_Page8();
        }
        else
        {
            if (ucOSD_Item_Index0 == PAGE8_ITEM_Exit)
            {
                ucOSD_Page_Index    = 0;
                ucOSD_Item_Index0   = 0;
                ucOSD_Item_Index1   = 0;
                ucOSD_Item_Index2   = 0;                 	
            }
            else
            {
                ucOSD_Item_Index1 = 1;
                Show_Page8();
            }
        }    
        break;

    case NOTIFY_RIGHT_KEY :     // Right-key to Increase; Left-key to Decrease
    case NOTIFY_LEFT_KEY :
        if (ucOSD_Item_Index1)
        {
            switch (ucOSD_Item_Index0)
            {
            case PAGE8_ITEM_Bright :
                if (NOTIFY_RIGHT_KEY == action)
                {
                    if (100 <= fac_bright)       break;

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

                    if (KEY_TURBO_ENABLE > ucKey_Issued)
                        fac_bright   = 0 < fac_bright ? fac_bright - 1 : 0;
                    else

⌨️ 快捷键说明

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