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

📄 osd.c

📁 myson的MTV332的DEMO程序 主要功能有菜单的设计和无线遥控以及视频参数的调节
💻 C
📖 第 1 页 / 共 5 页
字号:
void DriveBLUE(void)
{
        code BYTE progress[4] ={0,7,4,Driveblue};		
        ProgressSelect(progress);     
}

void Disp_Rotation(void)
{
#ifdef _MTV332_
	bRotationFlag++;
	if(bRotationFlag ==4)
		bRotationFlag =0;
	switch(bRotationFlag)
	{
		case 0:		
			byMTV_TCONADDR = 0x0f;   
		   	byMTV_TCONDATA = 0x04;	//Left To Right
		   	byMTV_TCONADDR = 0x10;  
		   	byMTV_TCONDATA = 0xC0;	//Down To Up
			break;
		case 1:
			byMTV_TCONADDR = 0x0f;   
		   	byMTV_TCONDATA = 0x00;	//Right To Left
		   	byMTV_TCONADDR = 0x10;  
		   	byMTV_TCONDATA = 0xE0;	//Up To Down
			break;
		case 2:
			byMTV_TCONADDR = 0x0f;   
		   	byMTV_TCONDATA = 0x00;	//Right To Left
		   	byMTV_TCONADDR = 0x10;  
		   	byMTV_TCONDATA = 0xC0;	//Down To Up
			break;
		case 3:		// Normal
			byMTV_TCONADDR = 0x0f;   
		   	byMTV_TCONDATA = 0x04;	//Left To Right
		   	byMTV_TCONADDR = 0x10;  
		   	byMTV_TCONDATA = 0xE0;	//Up To Down
			break;
	}
#endif
MenuProcess = Disp_VideoMenu;
}

/*
void HsyncSt(void)
{
        code BYTE progress[4] ={0,7,4,HsyncStITEM};		
        ProgressSelect(progress);     
}

void HsyncEnd(void)
{
        code BYTE progress[4] ={0,7,4,HsyncEndITEM};		
        ProgressSelect(progress);     
}*/

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

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

}

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

void Disp_VideoContrast(void)
{
        code BYTE progress[4] ={0,7,4,BRIGHT_CONTRAST};
        ProgressSelect(progress);
}
void Disp_VideoSubContrast(void)
{
        code BYTE progress[4] ={0,7,4,BRIGHT_SUBCONTRAST};
        ProgressSelect(progress);
}

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


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

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

void MoveWindow(BYTE ItemNum)
{
	code BYTE DispFormat[][6]=
	{
		 {_Z,_O,_O,_M,__,__},
		 {_C,_I,_N,_E,_M,_A},
		 {_N,_O,_R,_M,_A,_L},
 		 {_F,_U,_L,_L,__,__},
	};

	gotoxy(14,8);
	PrintByteString(DispFormat[ItemNum],6,0x06);	//0x62 :BG Yellow, color :green

	switch (ItemNum)
	{//winno, tartx,starty,endx,endy,color
		case 0: 			
			OpenWindow(2, 14,8,17,8,0x05);	break;
		case 1:
			OpenWindow(2, 14,8,19,8,0x05);	break;
		case 2:
			OpenWindow(2, 14,8,19,8,0x05);	break;				
		case 3:
			OpenWindow(2, 14,8,17,8,0x05);	break;
	}
}
void Execute_Format (void)
{
#ifdef _MTV332_
	BYTE i;
	
	BYTE code FullDisp[]=
	{
		0x06,0x04,
		0x11,0xaa,
		0x12,0x81,
		0x13,0x68,
		0x14,0xef,//0x14,0xff,
		0x15,0xef,//0x15,0xff,
		0x17,0x00,//0x17,0x03,
		0x19,0x00,		
		0x1b,0x40,
		0x1c,0x0F,
		0x1d,0xC2		
	};
	BYTE code NorDisp[]=		// 4:3
	{
		0x06,0x2C,
		0x11,0xF6,
		0x12,0x91,
		0x13,0x43,
		0x14,0x3C,
		0x15,0x67,
		0x17,0x02,
		0x19,0x2F,
		0x1b,0xBF,
		0x1c,0x0F,
		0x1d,0x81		
	};
	BYTE code Nonlinear[]=		// 4:3
	{
		0x06,0x2C,
		0x11,0xE6,
		0x12,0x81,
		0x13,0x7A,
		0x14,0xd5,
		0x15,0x3A,
		0x17,0x00,
		0x19,0x2F,
		0x1b,0xBF,
		0x1d,0x81		
	};
	
	BYTE code ZoomDisp[]=
		{
		0x02,0x51,
		0x03,0xb0,
		0x05,0x2D,
		0x09,0x55,
		0x0a,0x39,
		0x0b,0x0B,
		0x0c,0x2E,			
	};
	BYTE code NotZoomDisp[]=
		{
		0x02,0x70,
		0x03,0x85,
		0x05,0x2E,
		0x09,0x04,
		0x0a,0x2A,
		0x0b,0x08,
		0x0c,0x11,			
	};
#endif
	
	if(!bMenuFlag)
	  {
	  //		ShowProgress(progress);
		gotoxy(0,8);
		PrintByteString(Format_Item,15,White); //0x62 :BG Yellow, color :green
		MoveWindow(FormatValue);
		EnableOSD();
		bMenuFlag = 1;
		return;
	}
	
	 if(KeyNo != NOKEY || IR_Key != IR_No_Key)
			  OsdTimer = OSD_OFFTIME;
	
	  if(OsdTimer == 0)
	  {
		bMenuFlag = 0;
		MenuProcess = Disp_Entry;
	  }

	if (KeyNo == UPKEY  || KeyNo==DOWNKEY)	
	{
		if(KeyNo == DOWNKEY)
		{
			//ShowSubMenu(3);
			if (FormatValue <3)
				FormatValue ++;
			else
			FormatValue =0;
		}
		else
		{
			//ShowSubMenu(2);
			if (FormatValue  >0)
				FormatValue --;
			else
				FormatValue = 3;				
		}
		  
		MoveWindow(FormatValue);
		EnableOSD();

		switch(FormatValue)
		{
			case 0: //Zoom
				for(i=0;i<11;i++)
				{  
					byMTV_TCONADDR=FullDisp[2*i];
					byMTV_TCONDATA=FullDisp[2*i+1];
				}
				for(i=0;i<7;i++)
				{
					byMTV_TCONADDR=ZoomDisp[2*i];
					byMTV_TCONDATA=ZoomDisp[2*i+1];
				}
				break;
			case 1: //CINEMA		  
				for(i=0;i<11;i++)
				{  
					byMTV_TCONADDR=Nonlinear[2*i];
					byMTV_TCONDATA=Nonlinear[2*i+1];			
				}
				for(i=0;i<7;i++)
				{
					byMTV_TCONADDR=NotZoomDisp[2*i];
					byMTV_TCONDATA=NotZoomDisp[2*i+1];
				}
				break;
		case 2://NORMAL
#ifdef _MTV332_		  
			for(i=0;i<11;i++)
			{  
				byMTV_TCONADDR=NorDisp[2*i];
				byMTV_TCONDATA=NorDisp[2*i+1];			
			}
			for(i=0;i<7;i++)
			{
				byMTV_TCONADDR=NotZoomDisp[2*i];
				byMTV_TCONDATA=NotZoomDisp[2*i+1];
			}
#endif		  
			break;
			case 3://FULL 	
#ifdef _MTV332_		  
			for(i=0;i<11;i++)
			{  
				byMTV_TCONADDR=FullDisp[2*i];
				byMTV_TCONDATA=FullDisp[2*i+1];
			}
			for(i=0;i<7;i++)
			{
				byMTV_TCONADDR=NotZoomDisp[2*i];
				byMTV_TCONDATA=NotZoomDisp[2*i+1];
			}
#endif		  
			break;
		}			  

	}
	
	else  if(KeyNo == SELECTKEY || IR_Key == IR_Menu_Key||KeyNo == MENUKEY)
	{
		bMenuFlag=0;
		bSubMenuFlag=0;
		bClrFlag=0;
		MenuProcess = Disp_VideoMenu;
	}
	else  if (KeyNo==POWERKEY ||IR_Key == IR_Power_Key)
	{		
		bClrFlag=0;
		bMenuFlag=0;
		MenuProcess = Disp_PowerMenu;	
	}
}
void Execute_Recall(void)
{

	EEPROM_Read(sOSDAddrPreSt, &sOSD.H_Pos,sOSDDataSize); // user area
	EEPROM_Write(sOSDAddrSt, &sOSD.H_Pos, sOSDDataSize); 
	
  	EEPROM_Read(sBrightAddrPreSt, &sBright.Brightness, sBrightDataSize);// user area  	
  	EEPROM_Write(sBrightAddrSt, &sBright.Brightness, sBrightDataSize); 
	
	EEPROM_Read(sColor1AddrPreSt, &sColor.Saturation, sColorDataSize); // user area	
	EEPROM_Write(sColor1AddrSt, &sColor.Saturation, sColorDataSize);
	
	EEPROM_Read(sGammaAddrPreSt, &sGamma.Vg1, sGammaDataSize); // user area
       EEPROM_Write(sGammaAddrSt, &sGamma.Vg1, sGammaDataSize);


      EEPROM_Read(sVideoPosiAddSt, &sVideoPos.H_Pos, sVideoPosiDataSize); 
      EEPROM_Write(sVideoPosiAddPreSt, &sVideoPos.H_Pos, sVideoPosiDataSize); 

/*

	Set_BrightPWM = sBright.Brightness;//0xC1;//195;
	Set_ContrastPWM = sBright.Contrast;//0xCB;//185;
	Set_SaturatPWM =sColor.Saturation;//0xBD;//190;
	Set_TintPWM =sColor.Hue;//0xC4;//190;
  
 	GammaPWM_SUB1R =sGamma.Vg1R;
	GammaPWM_SUB2R =sGamma.Vg2R;
	GammaPWM_SUB1B = sGamma.Vg1B;
	GammaPWM_SUB2B =sGamma.Vg2B;
  	GammaPWM_VG1L =sGamma.Vg1;
	GammaPWM_VG2L =sGamma.Vg2;
*/
       bMenuFlag = 0;
	MenuProcess = Disp_Entry;

        Def_VideoData();		
	
}
#if 0
void Disp_VideoBright(void)
{

        code BYTE itembar[] = {MainPageXStart,MainPageYStart,MainPageBarLength,MaxBrightPageItem};
        code void (*menu[3])(void)      =
        {Disp_VideoBrightness,Disp_VideoContrast,ReturnMenuState
        };

        code BYTE progress[][4] =
        {       1,10,0,BRIGHT_BRIGHTNESS,
                 1,10,0,BRIGHT_CONTRAST,
                 1,10,0,NOTHING
        };

        if(!bMenuFlag)
        {
                //ShowMenu(menu_data[sOSD.Language]);
	       //   ClearOSDRegion(MainPageXStart,MainPageYStart,MainPageColor);
	       	          InitialOSD();
		   VideoBrightMenu();
                ShowProgress(progress[ItemIndex]);
		   EnableOSD();

                ItemSelect(itembar,menu);
                bMenuFlag = 1;
        }
        else
        {
                ItemSelect(itembar,menu);
		   
                if(KeyNo == UPKEY || KeyNo == DOWNKEY)
                {
                        ShowProgress(progress[ItemIndex]);
                }
                
        }

}
void Disp_VideoColor(void)
{
/*
        code BYTE *menu_data[] =
       {
        ENG_Video_Color,CHN_Video_Color
        };
*/
        code BYTE itembar[] = {MainPageXStart,MainPageYStart,MainPageBarLength,MaxColorPageItem};
        code void (*menu[])(void)      =
        {Disp_Saturation,Disp_Hue,ReturnMenuState
        };

        code BYTE progress[][4] =
        {       1,10,0,COLOR_SATURATION,
                1,10,0,COLOR_HUE,
                1,10,0,NOTHING
        };

        if(!bMenuFlag)
        {
                //ShowMenu(menu_data[sOSD.Language]);
                //ShowProgress(progress[ItemIndex]);
	         //ClearOSDRegion(MainPageXStart,MainPageYStart,MainPageColor);
	         	          InitialOSD();
		   VideoColorMenu();
                ShowProgress(progress[ItemIndex]);
                EnableOSD();
	         
                ItemSelect(itembar,menu);
                bMenuFlag = 1;
        }
        else
        {
                ItemSelect(itembar,menu);
		
                if(KeyNo == UPKEY || KeyNo == DOWNKEY)
                {
                        ShowProgress(progress[ItemIndex]);
                }
                
        }

}
#endif


#if 0
void Execute_Dimmer(void)
{//Need to show On/OFF
   code BYTE YesNo[]=
		{_O,__,_F,__,_F,__,__,__,__,__,__,__,_O,__,_N};

	  if(!bMenuFlag)
        {
	        gotoxy(0,8);
		  PrintByteString(Dimmer_Item,15,0x02);	//0x62 :BG Yellow, color :green		  
	        gotoxy(6,9);
		  PrintByteString(YesNo,15,0x06);	//0x62 :BG Yellow, color :green
//		   bSwapFlag= ~bSwapFlag;
		  if (bSwapFlag)  //On position
			  OpenWindow(2, 6,9,11,9,0x05);//winno, tartx,starty,endx,endy,color
		  else
			  OpenWindow(2, 18,9,21,9,0x05);//winno, tartx,starty,endx,endy,color
               bMenuFlag = 1;
               return;
        }

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

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

	 if (KeyNo == UPKEY  || KeyNo==DOWNKEY
			   || IR_Key == IR_Down_Key || IR_Key == IR_Up_Key) 	   
        {	 
        	if(KeyNo == DOWNKEY)
			ShowSubMenu(3);
		else
			ShowSubMenu(2);
		bSwapFlag= ~bSwapFlag;

		if (bSwapFlag)	//On position
		{
			OpenWindow(2, 6,9,11,9,0x05);//winno, tartx,starty,endx,endy,color
//			#ifndef _JRCPIN_
//			Dimmer=0x01;   //For Necvox Dimmer Pin control
//			#endif
		}
		else
		{
			OpenWindow(2, 18,9,21,9,0x05);//winno, tartx,starty,endx,endy,color
//			#ifndef _JRCPIN_
//			Dimmer=0x00;
//			#endif
		}		
		
        }

	else  if(KeyNo == SELECTKEY || IR_Key == IR_Menu_Key)
	 {
		bMenuFlag=0;
		bSubMenuFlag=0;
		bClrFlag=0;
		MenuProcess = Disp_VideoMenu;
	  }
	else  if (KeyNo==POWERKEY ||IR_Key == IR_Power_Key)
	  { 	
		bClrFlag=0;
		bMenuFlag=0;
		MenuProcess = Disp_PowerMenu;	
	  }
}

void Execute_Rotate(void)
{

		 rotatevalue= ~rotatevalue;
		 if (rotatevalue) 
		 {
			CTRL_LR=0x01;		
			CTRL_UD=0x01;
		}
		 else
		 {
			CTRL_LR=0x00;		
			CTRL_UD=0x00;
		}
}

void Disp_OSDHPosition(void)
{
        code BYTE progress[4] ={1,10,4,OSD_HPOS_U};

        ProgressSelect(progress);
}

void Disp_OSDVPosition(void)
{
        code BYTE progress[4] ={1,10,4,OSD_VPOS_U};

        ProgressSelect(progress);
}

void Disp_OSDLanguage()
{
/*
        code BYTE *label_data[] =
       {
                Str_ENG_English,
                Str_CHN_Chinese
        };
*/
//        LableSelect(OSD_LANGUAGE_U,OSDLanguage_Item[sOSD.LANGUAGE]);
}
void Disp_OSDSetup(void)
{
        code BYTE itembar[] = {MainPageXStart,MainPageYStart,MainPageBarLength,MaxOSDPageItem};
        code void (*menu[])(void)      =
        {Disp_OSDHPosition,Disp_OSDVPosition,ReturnMenuState };

        code BYTE progress[][3] =
        {      1,10,0,OSD_HPOS_U,
                1,10,0,OSD_VPOS_U,
                1,10,0,NOTHING
        };

        if(!bMenuFlag)
        {
                //ShowMenu(menu_data[sOSD.Language]);
                ShowProgress(progress[ItemIndex]);
               // ClearOSDRegion(MainPageXStart,MainPageYStart,MainPageColor);
		   InitialOSD();


		    OSDSetupMenu();
                 ShowProgress(progress[ItemIndex]);
			EnableOSD();

                ItemSelect(itembar,menu);
                bMenuFlag = 1;
        }
        else
        {
     		    OSDSetupMenu();
                ItemSelect(itembar,menu);
//              if(KeyNo == UPKEY || KeyNo == DOWNKEY)
//                {
//                        ShowProgress(progress[ItemIndex]);
//                }
        }

}
void Disp_OSDSetup(void)
{
/*
        code BYTE *menu_data[] =

⌨️ 快捷键说明

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