📄 mcu.c
字号:
else{
MenuPtr.Level = 0;
MenuPtr.Ptr = BackPtr;
MenuPtr.Op = oUPDATE;
}
}
break;
case vkSOURCE:
if(MenuPtr.Menu == 4)
{
// if(MenuPtr.Level == 0){
MenuPtr.Level = 1;
// MenuPtr.Op = oINCVAL;
// }
// else
MenuPtr.Op = oINCVAL;
OsdTimer = 3 * 100;
}
KeyLock = 1;
break;
case vkPOWER:
KeyLock = 1;
PowerOffProcess();
break;
case (vkVALUP|vkVADOWN): //fact mode and clear
if(FactMode && (MenuPtr.Menu == 2))
{
BackLightTimerEn = 0;
BackLightTimer = 0;
SaveBackLightTime();
ShowBackLightTime();
BackLightTimerEn = 1;
}
break;
case (vkMENU|vkPOWER):
if(NoSyncFlag && !BurnInMode && !PowerDown)
{
BurnInMode = 1;
Write24C16(ep_Status,StatusFlag);
ShowBurnInPattern(1);
KeyLock = 1;
}
break;
// case (vkMENU|vkLEFT|vkVALUP):
// if(OsdTimer < ((FuncBuf[pOSDTIMER] * 100) - 500))
// {
// KeyLock = 1;
// OsdLock = ~OsdLock;
// Write24C16(ep_Status,StatusFlag);
// }
// break;
};
}
void LED_GrnOn(void)
{
unsigned char port;
port = PTA_REG;
port |= RDPA_REG;
port |= PA2;
PTA_REG = port;
}
void LED_GrnOff(void)
{
unsigned char port;
port = PTA_REG;
port |= RDPA_REG;
port &= ~PA2;
PTA_REG = port;
}
void LED_RedOn(void)
{
unsigned char port;
port = PTA_REG;
port |= RDPA_REG;
port |= PA1;
PTA_REG = port;
}
void LED_RedOff(void)
{
unsigned char port;
port = PTA_REG;
port |= RDPA_REG;
port &= ~PA1;
PTA_REG = port;
}
void BackLightOn(void)
{
unsigned char port,temp;
if(FuncBuf[pVIDEOSOURCE] <= 2){
temp = ReadIIC563(0x020);
WriteIIC563(0x020,temp & (~BIT_0));
}
//else{
// temp = ReadIIC563(0x040);
// WriteIIC563(0x040,temp & (~BIT_0));
//}
//PanelPowerOn();//lo_cs
//DC2DCPowerOn();
//XAO_Off();//lo_cs
//XAO_On();//lo_cs
WaitSetup(5);
port = PTC_REG;
port |= RDPC_REG;
port |= PC0;
PTC_REG = port;
BackLightTimerEn = 1;
WaitSetup(5);
if(FuncBuf[pVIDEOSOURCE] <= 2){
temp = ReadIIC563(0x020);
WriteIIC563(0x020,temp|BIT_0);
}
//else{
// temp = ReadIIC563(0x040);
// WriteIIC563(0x040,temp|BIT_0);
//}
}
void BackLightOff(void)
{
unsigned char port,temp;
temp = ReadIIC563(0x16e);
WriteIIC563(0x16e,temp&(~BIT_0)); //lo_cs
port = PTC_REG;
port |= RDPC_REG;
port &= ~PC0;
PTC_REG = port;
BackLightTimerEn = 0;
}
bit DetectBacklight()
{
if(PTC_REG & PC0)
return 1;
else
return 0;
}
#if PanelPowerActive == High
void PanelPowerOn(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port |= PC7;
PTC_REG = port;
if(PanelInterface == TCON_TO_RSDS || PanelInterface == TCON_TO_TTL)
{
port = PTC_REG;
port |= RDPC_REG;
port |= PC3;
PTC_REG = port;
}
}
void PanelPowerOff(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port &= ~PC7;
PTC_REG = port;
if(PanelInterface == TCON_TO_RSDS || PanelInterface == TCON_TO_TTL)
{
port = PTC_REG;
port |= RDPC_REG;
port &= ~PC3;
PTC_REG = port;
}
}
#else
void PanelPowerOff(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port |= PC7;
PTC_REG = port;
if(PanelInterface == TCON_TO_RSDS || PanelInterface == TCON_TO_TTL)
{
port = PTC_REG;
port |= RDPC_REG;
port |= PC3;
PTC_REG = port;
}
}
void PanelPowerOn(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port &= ~PC7;
PTC_REG = port;
if(PanelInterface == TCON_TO_RSDS || PanelInterface == TCON_TO_TTL)
{
port = PTC_REG;
port |= RDPC_REG;
port &= ~PC3;
PTC_REG = port;
}
}
#endif
#if PANEL == CMO_M170ES05
void DC2DCPowerOn(void)
{
unsigned char port;
port = PTE_REG;
port |= RDPE_REG;
port &= ~PE0;
PTE_REG = port;
}
void DC2DCPowerOff(void)
{
unsigned char port;
port = PTE_REG;
port |= RDPE_REG;
port |= PE0;
PTE_REG = port;
}
void XAO_On(void)
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port |= PC3;
PTC_REG = Port;
}
void XAO_Off(void)
{
Byte Port;
Port = PTC_REG;
Port |= RDPC_REG;
Port &= ~PC3;
PTC_REG = Port;
}
#endif
void ResetOff(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port |= PC4;
PTC_REG = port;
}
void ResetOn(void)
{
unsigned char port;
port = PTC_REG;
port |= RDPC_REG;
port &= ~PC4;
PTC_REG = port;
}
/*
void FastMuteOn()
{
Byte Port;
WaitVblank();
Port = PTD_REG;
Port |= RDPD_REG;
Port |= PD4;
PTD_REG = Port;
}
void FastMuteOff()
{
Byte Port;
WaitVblank();
Port = PTD_REG;
Port |= RDPD_REG;
Port &= ~PD4;
PTD_REG = Port;
}
*/
/*
void SAA7114Off()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port &= ~PD1;
PTD_REG = Port;
}
void SAA7114On()
{
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port |= PD1;
PTD_REG = Port;
}
*/
void AUDIO_MUTE(void)
{
/*
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port |= PD1;
PTD_REG = Port;
*/
}
void AUDIO_On(void)
{
/*
Byte Port;
Port = PTD_REG;
Port |= RDPD_REG;
Port &= ~PD1;
PTD_REG = Port;
*/
}
/*
bit Saa7114Status()
{
if(PTD_REG & PD1)
return 1;
else
return 0;
// return 0;
}
*/
bit DetectDVI()
{
/*
if(PTD_REG & PD3)
return 0;
else
return 1;
*/
return 1;
}
/*
bit DetectDsub()
{
if(PTD_REG & PD5)
return 0;
else
return 1;
}
*/
bit DetectIRQ()
{
if(PTB_REG & PB2)
return 0;
else
return 1;
}
/*
bit DetectPower()
{
if(PTB_REG & PB3)
return 1;
else
return 0;
}
*/
bit VsyncValide()
{
Word VsyncWidth;
LocalTimer = 2; //20ms
while(!(PTD_REG & BIT_6)) //Vsync Lo
{
if(LocalTimer == 0)
return 0;
}
LocalTimer = 10; //100ms
while(PTD_REG & BIT_6) //Vsync Hi
{
if(LocalTimer == 0)
return 0;
}
VsyncWidth = 0;
while(!(PTD_REG & BIT_6)) //Vsync Hi 1:7us
{
VsyncWidth ++;
if(VsyncWidth > 50) //over 350us
return 0;
}
VsyncWidth = 0;
while(PTD_REG & BIT_6) //Vsync Hi 1:7us
{
VsyncWidth ++;
if(VsyncWidth > 714) //over 5ms
return 1;
}
return 0;
}
void WaitVblank()
{
LocalTimer = 3; //30ms
while(!(PTD_REG & BIT_6)) //Vsync Lo
{
if(LocalTimer == 0)
return;
}
LocalTimer = 5; //50ms
while(PTD_REG & BIT_6) //Vsync Hi
{
if(LocalTimer == 0)
return;
}
}
void IntGroup1(void) interrupt 2 using 1
{
Byte Port;
if(INT_SRC & INT_EXT)
if(INTEXT_FLG & INTE0)
{
if(FastMuteEnable)
{
Port = PTC_REG; //backlight off
Port |= RDPC_REG;
Port &= ~PC0;
PTC_REG = Port;
//Port = PTD_REG; //fastmute on
//Port |= RDPD_REG;
//Port &= ~PD4;
//PTD_REG = Port;
}
Abort = 1; //abort autotune
if(ChangeMode<10)
ChangeMode++;
INTEXT_FLG = INTE0;
}
}
void SetInverter(void)
{
Byte value;
// if(FuncBuf[pCOLORTEMP] < 4)
#if PANEL == CMO_M170E4_L01 || PANEL == LP_LM170E01
value = FuncBuf[pBACKLIGHT];
#else
value = 0x7f - FuncBuf[pBACKLIGHT];
#endif
// else
// value = FuncMax - FuncBuf[pBACKLIGHT2];
PWM9_REG = value * 2;
#if PRINT_MESSAGE
printf("FuncBuf[pBACKLIGHT] = %x\r\n",(unsigned short)value);
#endif
}
#define AUDIO_PWM_MAX 208
void SetAudioVolume(void)
{
unsigned char value;
value = (((FuncBuf[pVOLUME] * AUDIO_PWM_MAX) + 50) / 100);
//value = FuncBuf[pVOLUME];
PWM8_REG = value;
#if PRINT_MESSAGE
printf("FuncBuf[pVOLUME] = %x\r\n",(unsigned short)value);
#endif
}
void SetVCM_Vol(void)
{
unsigned char value;
value = FuncBuf[pVCMVOL];
PWM7_REG = value;
#if PRINT_MESSAGE
printf("FuncBuf[pVCMVOL] = %x\r\n",(unsigned short)value);
#endif
}
void SetAudioMute(void)
{
if(AudioMute)
AUDIO_MUTE();
else
AUDIO_On();
#if PRINT_MESSAGE
printf("AudioMute = %x\r\n",(unsigned short)AudioMute);
#endif
}
void PowerOffProcess()
{
Osd_Off();
PowerStatus = 0; //power off
Write24C16(ep_Status,StatusFlag);
PowerSaving();
LED_RedOff();
LED_GrnOff();
if((FactMode)&&(!BurnInMode))//jacky0316 Item41 BurnInMode
{
FactMode = 0;
FuncBuf[pCOLORTEMP] = 3; //Colortemp user
Write24C16(ep_Status,StatusFlag);
Write24C16(ep_Color_Ptr,2);
Write24C16(ep_Color4_R,Read24C16(ep_Color6_R)); //R Gain
Write24C16(ep_Color4_G,Read24C16(ep_Color6_G)); //G Gain
Write24C16(ep_Color4_B,Read24C16(ep_Color6_B)); //B Gain
//Write24C16(ep_Color5_R,Read24C16(ep_Color1_R)); //R Gain
//Write24C16(ep_Color5_G,Read24C16(ep_Color1_G)); //G Gain
//Write24C16(ep_Color5_B,Read24C16(ep_Color1_B)); //B Gain
#if PRINT_MESSAGE
printf("Release Factory mode\r\n");
#endif
while(GetKey() == 0);
Osd_Off();
}
while(1)
{
ScanKeyPad();
//KeyScan();
//KeyBuffer &= 0x7F;
if((KeyBuffer&vkPOWER) && !KeyLock)
{
PowerStatus = 1; //power on
BurnInMode = 0;
Write24C16(ep_Status,StatusFlag);
WarmUp();
}
}
}
void CheckAnyKey()
{
if(Abort)
return;
if(GetKey() == vkPOWER)
Abort = 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -