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

📄 osd.c

📁 myson的MTV332的DEMO程序 主要功能有菜单的设计和无线遥控以及视频参数的调节
💻 C
📖 第 1 页 / 共 5 页
字号:
			case Vcomdc:
				PrintByteString(VCOMDC_Str_Item,sizeof(VCOMDC_Str_Item),MainPageCharColor);
				break;

			case Drivered:
				PrintByteString(DriveRed_Str_Item,sizeof(DriveRed_Str_Item),MainPageCharColor);
				break;

			case Drivegreen:
				PrintByteString(DriveGreen_Str_Item,sizeof(DriveGreen_Str_Item),MainPageCharColor);
				break;

			case Driveblue:
				PrintByteString(DriveBlue_Str_Item,sizeof(DriveBlue_Str_Item),MainPageCharColor);
				break;

			case OSDHPosi:
				PrintByteString(OSDH_Item,sizeof(OSDH_Item),MainPageCharColor);
				break;

			case OSDVPosi:
				PrintByteString(OSDV_Item,sizeof(OSDV_Item),MainPageCharColor);
				break;

			case WHITELIMITE:
				PrintByteString(WhiteLimiter_Item,sizeof(WhiteLimiter_Item),MainPageCharColor);
				break;

			case BLACKLIMITE:
				PrintByteString(BlackLimiter_Item,sizeof(BlackLimiter_Item),MainPageCharColor);
				break;

			case Video_VPosi:
				PrintByteString(VerticalPos_Item,sizeof(VerticalPos_Item),MainPageCharColor);
				break;

			case Video_HPosi:
				PrintByteString(HoriPos_Item,sizeof(HoriPos_Item),MainPageCharColor);
				break;		

			/*
			case HsyncStITEM:				
				PrintByteString(HsyncStStr,15,MainPageCharColor);
				break;
			
			case HsyncEndITEM:				
				PrintByteString(HsyncEndStr,15,MainPageCharColor);
				break;*/
		}
		

		//New method for Necvox only modify block place
		ShowEmptyBar1(BarSt,BarY);  //Only special to paint a 0~15 green line
		ShowBar1(prog[0],prog[1],temp);	//The Showbar1 only show 1 block
		gotoxy(ValueX,ValueY);// Value char put at [29,6]
		//PrintByteString(msgbuf,ValueLen,MainPageProcessColor);
		PrintValue(temp,MainPageProcessColor);
	}
	else
		ShowInputSource(ItemValue.value);
}


void ProgressSelect(BYTE *progress)
{
	EnableOSD(); //

	if(!bMenuFlag)
	{
		ShowProgress(progress);
		bMenuFlag = 1;
		return;
	}

	if(KeyNo != NOKEY || IR_Key != IR_No_Key)
		OsdTimer = OSD_OFFTIME;

	if(OsdTimer == 0)
	{
		bMenuFlag = 0;
		MenuProcess = Disp_Entry;
	}

	if(KeyNo == DOWNKEY|| IR_Key == IR_Left_Key)			
	{
		if(progress[3] != InputSource)
		{
			if(ItemValue.value == ItemValue.min)
				return;
			if(ItemValue.value > ItemValue.min)
				ItemValue.value--;
			else
				ItemValue.value = ItemValue.min;
		}
		else
		{
			if(ItemValue.value == 0)
				ItemValue.value = 3;
			else if(ItemValue.value == 3)
				ItemValue.value = 2;
			else if(ItemValue.value == 2)
				ItemValue.value = 1;
			else if(ItemValue.value == 1)
				ItemValue.value = 0;
		}
		SetProgressData(progress[3]);
		ShowProgress(progress);	
		    //ShowSubMenu(3);			// Mark in 050807 for disable sub menu
	}
	else if(KeyNo == UPKEY || IR_Key == IR_Right_Key)
	{
		if(progress[3] != InputSource)
        	{
			if(ItemValue.value == ItemValue.max)
				return;
			if(ItemValue.value < ItemValue.max)
				ItemValue.value++;
			else
				ItemValue.value = ItemValue.max;				
		}
		else
		{
			if(ItemValue.value == 0)
				ItemValue.value = 1;
			else if(ItemValue.value == 1)
				ItemValue.value = 2;
			else if(ItemValue.value == 2)
				ItemValue.value = 3;
			else if(ItemValue.value == 3)
				ItemValue.value = 0;
		}
		SetProgressData(progress[3]);
		ShowProgress(progress);				
		   //ShowSubMenu(2);		// Mark in 050807	for disable sub menu
	}
		
	else  if(KeyNo == SELECTKEY || IR_Key == IR_Menu_Key || KeyNo == MENUKEY)
	{        
		bMenuFlag=0;
		bSubMenuFlag=0;
		bClrFlag=0;
		if(progress[3] == InputSource)
		{
		 	SetInputSource();
		}
		switch(MenuFlagState)
		{
			case 0:
				MenuProcess = Disp_VideoMenu;
				break;
			case 1:
				 MenuProcess = GammaPWM;
				break;
			case 2:
				MenuProcess = DispContBright;
				break;
			case 3:
				MenuProcess = OSDSetup;
				break;
			case 4:
				MenuProcess = Disp_VideoPos;
				break;
		}
		SaveProgressData(progress[3]);
        }
	else  if (KeyNo==POWERKEY ||IR_Key == IR_Power_Key)
	{
			//bSubMenuFlag=0;
		if (!bGammaFlag)
		{
			bClrFlag=0;
			bMenuFlag=0;
			MenuFlagState = 0;
			MenuProcess = Disp_PowerMenu;
		}
	}
}

void ItemSelect(BYTE *itembar,void (**menu)(void))
{

	if(KeyNo != NOKEY || IR_Key != IR_No_Key)
		OsdTimer = OSD_OFFTIME;

	if(OsdTimer == 0)
	{
		bMenuFlag = 0;
		MenuProcess = Disp_Entry;	
	}
	
	if(KeyNo == UPKEY || IR_Key == IR_Right_Key)
	{
		bClrFlag=0;
		if(ItemIndex < (itembar[3]-1)) 
			ItemIndex++;			
		else
		{
			byMTV_OSDRA=(ItemIndex+1)|Address;
			byMTV_OSDCA=0;
			byMTV_OSDDT0= 0x00;
			ItemIndex=0;			
		}
		ShowBar(ItemIndex);
	}
	else if(KeyNo == DOWNKEY || IR_Key == IR_Left_Key)
	{
		bClrFlag=0;
		if(ItemIndex >0)// (itembar[3]-1)) 
			ItemIndex--;			
		else
		{
			byMTV_OSDRA=(ItemIndex-1)|Address;
			byMTV_OSDCA=0;
			byMTV_OSDDT0= 0x00;
			ItemIndex=(itembar[3]-1);			
		}
		ShowBarDown(ItemIndex,itembar[3]);
	}

 // If UP/DOWN then NEED Run function		
	else if (KeyNo == SELECTKEY|| KeyNo==MENUKEY|| IR_Key == IR_Menu_Key ) 	   
	{
		if (!bClrFlag)
		{
			ClearMenu();
			bClrFlag=1;
		}
		/*		// Mark in 050807	for disable sub menu
		if (KeyNo == UPKEY)
			ShowSubMenu(2);
		else
			ShowSubMenu(3);
		*/
		 //if(menu[ItemIndex] != ReturnMenuState)
               //         SaveMenuState();
		CloseWindow(1);
		MenuProcess = menu[ItemIndex];
		bMenuFlag=0;
	}

	else  if (KeyNo==POWERKEY ||IR_Key == IR_Power_Key)
	{
			//bSubMenuFlag=0;
		if (!bGammaFlag)
		{
			bClrFlag=0;
			bMenuFlag=0;
			MenuFlagState = 0;
			MenuProcess = Disp_PowerMenu;
		}
	}
}


void PowerSelect (void)
{
	
	 if(KeyNo != NOKEY || IR_Key != IR_No_Key)
		  OsdTimer = OSD_OFFTIME;
		
	 if(OsdTimer == 0)
	 {
		  bMenuFlag = 0;
		  bSubMenuFlag = 0;
		  MenuProcess = Disp_Entry;
	  }
	
		  
	  if (KeyNo==POWERKEY ||IR_Key == IR_Power_Key)
	  {
		SourceFlag = ~SourceFlag;
		gotoxy(SrcStrSt,1);
		 if (SourceFlag)
		 {
			 PrintByteString(SStr1,SrcStrLen,SrcStrColor); 
		 	}
		else
		{
			PrintByteString(SStr2,SrcStrLen,SrcStrColor); 
		}
	  }
	
	  else if (KeyNo == UPKEY  || KeyNo==DOWNKEY
	  	        || IR_Key == IR_Left_Key || IR_Key == IR_Right_Key)		
	  {  
		NTSCFlag = ~NTSCFlag;		
		gotoxy(NtscStrSt,1);
		if (NTSCFlag)
		{
			PrintByteString(NTSCStr,NtscStrLen,NtscStrColor);
			Set_TintPWM =0xc0;
			
#ifdef _MTV332_			
			byMTV_TCONADDR=0x0b;
			byMTV_TCONDATA=0x88;
#endif			
		}
		else
		{
			PrintByteString(PALStr,NtscStrLen,NtscStrColor);			
			Set_TintPWM =0x00;
#ifdef _MTV332_				
			byMTV_TCONADDR=0x0b;
			byMTV_TCONDATA=0x86;
#endif
		}
	
		if (KeyNo == UPKEY || IR_Key == IR_Right_Key)
			ShowSubMenu(2);
		else if  (KeyNo == DOWNKEY || IR_Key == IR_Left_Key)
			ShowSubMenu(3);	
	  }
	  
	  else if(KeyNo == SELECTKEY || IR_Key == IR_Menu_Key)
	  {
		  bMenuFlag=0;
		   bSubMenuFlag=0;
		  bClrFlag=0;
		  MenuProcess = Disp_VideoMenu;//Disp_Entry;//ReturnMenuState;
	  }
}

//Power key need show NTSC/PAL MODE 
 //At this menu, if type UP/DOWN will change NTSC/PAL define
 //Menu key will show OSD menu again
void Disp_PowerMenu(void)
{      		
        if(!bSubMenuFlag)
        {
		InitialOSD();
//   		ClearMenu();
		
		ShowSubMenu(0);	//VideoMenu();	// fill data to display ram                
		gotoxy(SrcStrSt,1);

		if (SourceFlag)
			PrintByteString(SStr1,SrcStrLen,SrcStrColor); 
		else
			PrintByteString(SStr2,SrcStrLen,SrcStrColor); 

		gotoxy(NtscStrSt,1);
		if (NTSCFlag)
			PrintByteString(NTSCStr,NtscStrLen,NtscStrColor);
		else
			PrintByteString(PALStr,NtscStrLen,NtscStrColor);

		EnableOSD();	// enable osd
		bSubMenuFlag = 1;
		
		PowerSelect();
        }		
	  else
	  {
		PowerSelect();
		
	  }
}
#if 0
#define RangeLineColor 0x00
#define RangeBLKColor 0x03

void Disp_Demo(void)
{
	BYTE i;

	bDEMOFlag=1;
      InitialOSD();
	EnableOSD();   // enable osd
//	byM332FSSTP=0xF0;  //test pattern enable with blue color

	gotoxy(7,1);
    PrintChar(0x46,RangeBLKColor);
	for (i=0 ; i< 12 ; i++)
		 PrintChar(0x5D, RangeLineColor);
	PrintChar(0x54, RangeBLKColor);
	//Right side
	gotoxy(21,2);
	PrintChar(0x60, RangeBLKColor);
	gotoxy(21,3);
	PrintChar(0x6C, RangeBLKColor);
	//Left Side
	gotoxy(6,2);
	PrintChar(0x52, RangeBLKColor);
	gotoxy(6,3);
	PrintChar(0x5E, RangeBLKColor);


	gotoxy(5,4);
	PrintChar(0x6A, RangeBLKColor); //First one
	for (i=0 ; i< 16 ; i++)
		 PrintChar(0x5D, RangeLineColor);
	PrintChar(0x61, RangeBLKColor);

     //Right Side
	gotoxy(22,5);
	PrintChar(0x6D, RangeBLKColor);
	gotoxy(23,6);
	PrintChar(0x6E, RangeBLKColor);
	//Left Side
	gotoxy(5,5);
	PrintChar(0x53, RangeBLKColor);
	gotoxy(4,6);
	PrintChar(0x5F, RangeBLKColor);


	gotoxy(4,7);
	PrintChar(0x47, RangeBLKColor); //First one
	for (i=0 ; i< 18 ; i++)
		 PrintChar(0x5D, RangeLineColor);
	PrintChar(0x6F, RangeBLKColor);

	//Right Side
	gotoxy(24,8);
	PrintChar(0x64, RangeBLKColor);
	gotoxy(24,9);
	PrintChar(0x70, RangeBLKColor);

	
	//Left Side
	gotoxy(3,8);
	PrintChar(0x45, RangeBLKColor);
	gotoxy(3,9);
	PrintChar(0x51, RangeBLKColor);
	
	gotoxy(3,10);
	PrintChar(0x65, RangeBLKColor);
	for (i=0 ; i< 20 ; i++)
		 PrintChar(0x5D, RangeLineColor);
	PrintChar(0x71, RangeBLKColor);
	DoWait(5000);
	
//	byM332FSSTP=0x00;  //test pattern enable with blue color
//	MenuProcess = Disp_Entry;     
}
#endif
#if 0
void Disp_Demo(void)
{
	code BYTE WelcomStr[]=
		{_W,__,_E,__,_L,__,_C,__,_O,__,_M,__,_E};//,__,__,__,_T,__,_O}; //19
	
	code BYTE MyStr[]=
		{_M,__,_Y};
	
	code BYTE WorldStr[]=
		{_V,__,_I,__,_D,__,_E,__,_O,__,_W,__,_O,__,_R,__,_L,__,_D};

	BYTE i;

	bDEMOFlag=1;
    InitialOSD();
	EnableOSD();   // enable osd
	byM332FSSTP=0xF0;  //test pattern enable with blue color

	for (i=9 ; i>3 ; i--)
	{
		gotoxy(8,i);
		PrintString(WelcomStr,13,(i-3)%7);//i%7);
		gotoxy(14,i+2);		
		PrintString(MyStr,3,(i-3)%7);//(i+1)%7);
		gotoxy(6,i+4);
		PrintString(WorldStr,19,(i-3)%7);
		DoWait(300);		
		ClearRow(i, 8, 13);		
		ClearRow(i+2, 14,3);		
		ClearRow(i+4, 6,19);		
	}
	DoWait(1000);
	byM332FSSTP=0x00;  //test pattern enable with blue color
	MenuProcess = Disp_Entry;     
}
#endif
void GammaPWM(void)
{
        code BYTE itembar[] = {0,1,15,8};
        code void (*menu[])(void) =
        {
		GammaVG1,
         	GammaVG2,
      		VComAMP,
	      VComDC,
    	      DriveRED,
     	      DriveGREEN,
     	      DriveBLUE,
     	      ReturnMain,
        };		

        if(bMenuFlag == 0)
        {
        	bClrFlag=0;
		if (MenuFlagState==0)  //Only First time return to zero
		     	ItemIndex=0;
			
          	InitialOSD();
            GammaMenu();	// fill data to display ram                
            EnableOSD();	// enable osd
            ShowBar(ItemIndex);				
//                GammaSelect(itembar,menu);
		ItemSelect(itembar,menu);
		//ShowSubMenu(1);		// Mark in 050807	for disable sub menu
	   	bMenuFlag = 1;
	  	bGammaFlag=1;
		MenuFlagState = 1;
        }
        else
        {        
//		GammaSelect(itembar,menu);
	  ItemSelect(itembar,menu);

	  }	
}


void Disp_VideoMenu(void)
{
	code BYTE itembar[] = {MainPageXStart,MainPageYStart,MainPageBarLength,MaxMainPageItem};

	/*
        code void (*menu[])(void) =
        {DispContBright,Disp_Rotation,Execute_Format,
    	   GammaPWM,DispInputSource,Disp_VideoDefault,Disp_Entry,
        };	
	*/
	code void (*menu[])(void) =
	{	DispContBright,Disp_Rotation,Execute_Format,
		GammaPWM,DispInputSource,OSDSetup,Disp_VideoPos,Disp_VideoDefault,Disp_Entry
	};	
		
		/*
	  code void (*menu[])(void) =
        {Disp_Saturation,DispContBright,Disp_Hue,Disp_Sharpness,Disp_Rotation,Execute_Format,
    	   GammaPWM,Execute_Recall,Disp_VideoDefault,Disp_Entry,
        };	
	*/
	if(bMenuFlag == 0)
	{
		InitialOSD();
		VideoMenu();	// fill data to display ram                
		EnableOSD();	// enable osd
		ShowBar(ItemIndex);
		ItemSelect(itembar,menu);
		    //ShowSubMenu(1);		// Mark in 050807	for disable sub menu
		bMenuFlag = 1;
		if(i2c_flag)
		{
			gotoxy(27,1);
			PrintString(DEBUG_STR,1,Magenta);
		}
		else
		{
			gotoxy(27,1);
			PrintString(__,1,Magenta);
		}
	}
	else
	{        
		ItemSelect(itembar,menu);
	}	
}

void GammaVG1(void)
{
        code BYTE progress[4] ={0,7,4,GammaVg1};		
        ProgressSelect(progress);     
}

void GammaVG2(void)
{
        code BYTE progress[4] ={0,7,4,GammaVg2};		
        ProgressSelect(progress);     
}
void VComAMP(void)
{
        code BYTE progress[4] ={0,7,4,Vcomamp};		
        ProgressSelect(progress);     
}
void VComDC(void)
{
        code BYTE progress[4] ={0,7,4,Vcomdc};
        ProgressSelect(progress);     
}
void DriveRED(void)
{
        code BYTE progress[4] ={0,7,4,Drivered};		
        ProgressSelect(progress);     
}
void DriveGREEN(void)
{
        code BYTE progress[4] ={0,7,4,Drivegreen};		
        ProgressSelect(progress);     
}

⌨️ 快捷键说明

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