📄 lcd_osd.c
字号:
Data[5] = (row==0) ? 0x11 : 0x1c;
else if (12 > color)
Data[5] = (row==0) ? 0x12 : 0x1d;
else
Data[5] = (row==0) ? 0x13 : 0x1e;
}
}
else
{
Data[5] = (row==0) ? 0x10 : 0x1b;
}
}
else
{
if( bound )
{
if( bound >= (range*6) )
{
Data[5] = 0x1a;
bound = bound - range*6;
}
else
{
color = (bound << 4) / (range*6);
bound = 0;
if (1 > color)
Data[5] = 0x14;
else if (4 > color)
Data[5] = 0x15;
else if (6 > color)
Data[5] = 0x16;
else if (9 > color)
Data[5] = 0x17;
else if (11 > color)
Data[5] = 0x18;
else if (14 > color)
Data[5] = 0x19;
else
Data[5] = 0x1a;
}
}
else
{
Data[5] = 0x14;
}
}
RTDWrite(Data);
}
range = value / 10;
row = value - (range * 10); // x1
color = range / 10; // x100
range = range - (color * 10); // x10
row = row + 0x01;
range = (range || color) ? range + 0x01 : 0x00;
color = color ? color + 0x01 : 0x00;
Data[0] = 5;
Data[1] = Y_INC;
Data[2] = OSD_ADDR_MSB_90;
Data[3] = (unsigned char)((((usStart_Addr + col) >>8 ) & 0x0f ) | 0x50);
Data[4] = (unsigned char)( (usStart_Addr + col ) & 0x00ff);
Data[5] = 0;
RTDWrite(Data);
Data[0] = 6;
Data[1] = N_INC;
Data[2] = OSD_DATA_92;
Data[3] = color; // Number x100
Data[4] = range; // Number x10
Data[5] = row; // Number x1
Data[6] = 0;
RTDWrite(Data);
}
void Init_Page(unsigned char index)
{
index = index;
OSD_Position(OSD_ENABLE);
OSD_Clear(5, 11, 15, 1); //Need to be modified case by case.
if( ucOSD_Page_Index == 1)
RTDOSDW(OSD_Window_Setting);
}
void Show_Osd_Page(unsigned char Page_Num,unsigned char* Page_Attr,unsigned char OSD_Table_Num)
{
Init_Page(Page_Num);
RTDOSDW(Page_All_Atb);
RTDOSDW(OSD_PAGE_All_TABLE[0][stGUD1.FUNCTION & 0x07]);
RTDOSDW(Page_Attr);
RTDOSDW(OSD_PAGE_TABLE[OSD_Table_Num][stGUD1.FUNCTION & 0x07]);
Show_Mode();
}
void Bright_Contrast_Adjust(unsigned char* variable,unsigned char Key)
{
if (NOTIFY_RIGHT_KEY == Key)
{
if (100 <= *variable)
return;
if (!bKeyTurbo)
*variable = 100 > *variable ? *variable + 1 : 100;
else
*variable = 99 > *variable ? *variable + 2 : 100;
}
else
{
if (0 == *variable)
return;
if (!bKeyTurbo)
*variable = 0 < *variable ? *variable - 1 : 0;
else
*variable = 1 < *variable ? *variable - 2 : 0;
}
}
void Osd_Change_Item(unsigned char Pess_Key,unsigned char Item_Num)
{
if (ucOSD_Item_Index0)
{
// Select and highlight the next/previous item
//OSD_Window( 6, 150, 282, (54 + (ucOSD_Item_Index0-1)*(29+4)), (84 + (ucOSD_Item_Index0-1)*(29+4))
// , 0, 0, 14, 251, 0, 1, 0);
if (NOTIFY_RIGHT_KEY == Pess_Key)
ucOSD_Item_Index0 = (Item_Num == ucOSD_Item_Index0) ? 1 : (ucOSD_Item_Index0 + 1);
else
ucOSD_Item_Index0 = (1 == ucOSD_Item_Index0) ? Item_Num : (ucOSD_Item_Index0 - 1);
// Move window 6
OSD_Window( 6, 150, 282, (54 + (ucOSD_Item_Index0-1)*(29+4)), (84 + (ucOSD_Item_Index0-1)*(29+4))
, 1, 1, 14, 251, 0, 1, 25);
}
else
{
// Change to next/previous main page
//OSD_Window( 5, 150, 282, (54 + (ucOSD_Page_Index-1)*(29+4)), (84 + (ucOSD_Page_Index-1)*(29+4))
// , 0, 0, 14, 251, 0, 1, 0);
if (NOTIFY_RIGHT_KEY == Pess_Key)
ucOSD_Page_Index = GetNextPageIdx(ucOSD_Page_Index);
else
ucOSD_Page_Index = GetPrevPageIdx(ucOSD_Page_Index);
}
}
void Show_Mode(void)
{
unsigned int idata usStart_Addr;
unsigned char idata ucTemp;
OSD_Line(3, 12, 15, 0, 1); // Attribute
usStart_Addr = FONT_SELECT_ADDRESS;
//The address of the first character Cn1 in Row n = FONT_SELECT_ADDRESS + Row0_length + Row1_length +...+Row(n-1)_length
for(ucTemp = 1; ucTemp < 3+1; ucTemp ++)
usStart_Addr += Row_Info[0][ucTemp];
Data[0] = 5;
Data[1] = Y_INC;
Data[2] = OSD_ADDR_MSB_90;
Data[3] = (unsigned char)( (((usStart_Addr + 12) & 0x0fff) >> 8 ) | 0x50);
Data[4] = (unsigned char)( (usStart_Addr + 12) & 0x00ff);
Data[5] = 0;
RTDWrite(Data);
switch (ucMode_Curr)
{
case MODE_NOSIGNAL:
case MODE_NOSUPPORT:
break;
/*
case MODE_NOSIGNAL: // NO SIGNAL
OSD_Line(11, 2, 24, CHINESE_T <= (stGUD1.FUNCTION & 0x07) ? 0x80 | COLOR_BLUE : COLOR_BLUE, 0);
if ((SOURCE_VGA == (stGUD1.INPUT_SOURCE & 0x07)) && (VGA_ONLINE != bVGA_CONNECT))
RTDOSDW(OSD_REMK_TABLE[0][stGUD1.FUNCTION & 0x07]);
else
RTDOSDW(OSD_REMK_TABLE[1][stGUD1.FUNCTION & 0x07]);
break;
case MODE_UNDEFINED0:
case MODE_UNDEFINED1:
case MODE_NOSUPPORT:
OSD_Line(11, 2, 24, CHINESE_T <= (stGUD1.FUNCTION & 0x07) ? 0x80 | COLOR_BLUE : COLOR_BLUE, 0);
RTDOSDW(OSD_REMK_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;
case 0x03: RTDCodeW(Remark_V60_5); 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] = 0x0e;
ucTemp = usIPV_ACT_LEN / 100;
Data[12] = usIPV_ACT_LEN - ((unsigned int)100 * ucTemp);
if (10 <= ucTemp)
{
Data[0] = 13;
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_;
Data[12] = 0x00;
Data[13] = 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] = 0x00;
Data[12] = 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] = 0x27;
Data[6] = 0x59;
Data[7] = 0;
RTDWrite(Data);
if (10 <= ucTemp)
OSD_Line( 3, 21, 1, 0x8c, 0);
else
OSD_Line( 3, 20, 1, 0x8c, 0);
}
break;
}
}
void Page0_Left_Right_Key(unsigned char Key)
{
if(NOTIFY_RIGHT_KEY == Key)
{
if (SOURCE_VGA == (stGUD1.INPUT_SOURCE & 0x07) && MODE_NOSIGNAL != ucMode_Curr && MODE_NOSUPPORT != ucMode_Curr)
{
RTDSetBit(OVL_CTRL_6D, 0xfe, 0x00);
RTDOSDW(OSD_Reset);
// Issac : You can add OSD for auto-config here.
if (ERROR_INPUT == Auto_Config()) ucMode_Curr = MODE_OSDFORCE;
}
}
}
void Page0_Enter_Key(void)
{
// 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;
}
void Page0_LR_Key(void)
{
// No Function
}
void Page1_Enter_Key(void)
{
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;
//Enable window 6 and draw it
OSD_Window( 6, 150, 282, 54, 84, 1, 1, 14, 251, 0, 1, 25);
}
}
else
{
if (ucOSD_Item_Index1)
{
// Leave the item and reset text color
switch (ucOSD_Item_Index0)
{
case PAGE1_ITEM_CONTRAST :
// Redraw slider and make the number become black.
OSD_Slider(5, 31, 17, stGUD0.CONTRAST, 100, 4, 14);
break;
case PAGE1_ITEM_BRIGHT :
// Redraw slider and make the number become black.
OSD_Slider(7, 31, 17, stGUD0.BRIGHT, 100, 4, 14);
break;
case PAGE1_ITEM_COLORTEMP :
//Set words color to black
OSD_Line( 11, 36 + (ucOSD_Item_Index1-1)*(4+1), 4, 0x40, 2);
break;
case PAGE1_ITEM_GAMMA :
//Set words color to black
OSD_Line( 9, 36 + (ucOSD_Item_Index1-1)*(2+1), 1, 0x40, 2);
break;
}
ucOSD_Item_Index1 = 0;
}
else
{
if (PAGE1_ITEM_EXIT == ucOSD_Item_Index0)
{
// Disable highlight window 6
OSD_Window( 6, 150, 282, (54 + (ucOSD_Item_Index0-1)*(29+4)), (84 + (ucOSD_Item_Index0-1)*(29+4))
, 0, 0, 14, 251, 0, 1, 0);
// De-select the page item and disable the hightlight window
ucOSD_Item_Index0 = 0;
ucOSD_Item_Index1 = 0;
}
else if (MODE_NOSIGNAL != ucMode_Curr && MODE_NOSUPPORT != ucMode_Curr)
{
switch (ucOSD_Item_Index0)
{
case PAGE1_ITEM_CONTRAST :
ucOSD_Item_Index1 = 1;
// Redraw slider and make the number become Red.
OSD_Slider(5, 31, 17, stGUD0.CONTRAST, 100, 2, 14);
break;
case PAGE1_ITEM_BRIGHT :
ucOSD_Item_Index1 = 1;
// Redraw slider and make the number become Red.
OSD_Slider(7, 31, 17, stGUD0.BRIGHT, 100, 2, 14);
break;
case PAGE1_ITEM_COLORTEMP :
ucOSD_Item_Index1 = ((stGUD1.INPUT_SOURCE & 0x18) >> 3) + 1;
//Here we can only change the color in Byte 2 for necessary words
OSD_Line( 11, 36 + (ucOSD_Item_Index1-1)*(4+1), 4, 0x20, 2);
break;
case PAGE1_ITEM_GAMMA :
ucOSD_Item_Index1 = ((stGUD1.FUNCTION >> 5) & 0x03) + 1;
//Here we can only change the color in Byte 2 for necessary words
OSD_Line( 9, 36 + (ucOSD_Item_Index1-1)*(2+1), 1, 0x20, 2);
break;
case PAGE1_ITEM_RGBADJ :
OSD_Window( 6, 150, 282, (54 + (ucOSD_Item_Index0-1)*(29+4)), (84 + (ucOSD_Item_Index0-1)*(29+4))
, 0, 0, 14, 251, 0, 1, 0);
ucOSD_Item_Index1 = PAGE1B_ITEM_RED;
ucOSD_Item_Index2 = 0;
OSD_Proc_B(NOTIFY_SHOW); // Show the sub-page
break;
}
}
}
}
}
void Page1_Left_Right_Key(unsigned char Key)
{
if (ucOSD_Item_Index1)
{
switch (ucOSD_Item_Index0)
{
case PAGE1_ITEM_CONTRAST :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -