📄 main.c
字号:
/****************************************************************************
+----------------------------------------------------------------------+
| Copyright Trumpion Microelectronics Inc. 1999 |
| Trumpion Microelectronics Inc. reserves the right to change products |
| or specifications without notice. |
+----------------------------------------------------------------------+
Project : LCD monitor
Version : 0.94
File Name : main.c
Functions : main routine for LCD project
Revision :
1999-05-18 OriginalTeam First Created
2000-07-17 Bill Tseng Modified for Zurac-II
****************************************************************************/
//=========================================================================
// include files =
//=========================================================================
#include "lib\extent.h"
#include "lib\wreg516.h"
#include "lib\declare.h"
#include "lib\global.h"
#include "lib\modedata.h"
#include "lib\initial.h"
#include "lib\ttfc.h"
#include "lib\key.h"
#include "lib\osdm.h"
#include "lib\modedet.h"
#include "lib\eeprom.h"
#include "lib\osdmenu.h"
#include "lib\adc.h"
#include "LIB\MISC.H"
// extern function
extern Bool autofunction(Bool);
extern Bool white_balance(void);
extern void OsdShowWindowA(void);
extern void Align(void);
// extern void ShowTest(void);
//**************************************************************************
// PROGRAM SECTION
//**************************************************************************
main()
{
PowerOnInit(); /* power-on procedure */
CheckPowerKey();
KeyCheck();
TI=0;
while( 1 )
{
Align();
Key(); /* key press process */
ModeDetect(); /* detect Analog display mode */
if( FgModeChange )
{
// ModeChangeMode();
FgShowBurnin=0; //algu 1123
ModeChangeMode();
FgModeChange = 0;
FgOsdAct = 0;
FgFunInc=0;
}
if( FgWhiteOn ) /* white-balance function */
{
FgWhiteOn = 0;
#if BLUE_AUTO
ZuracWriteByte(0x04,0x12); /* Flush Screen to blue */
#endif
MUTEEnable();
OsdShowMessage(AUTOBALANCE_MESSAGE); //L3_WHITEBALANCE
TrmBuf[0] = Zurac03Value(ModeCounter);
if( white_balance() )
{
FgScalerAct = FgScalerAdj = 1;
EepromCommonStore(1); /* store Brightness,Contrast,Gain,Offset */
EepromColorStore(ColorTemp);
}
OsdEnable( 0 );
MUTEDisable();
#if BLUE_AUTO
ZuracWriteByte(0x04,0x00); /* Flush Screen to blank */
#endif
}
// if( FgOsdAct ) /* osd display */
// {
// OsdHandler();
// FgOsdAct = 0;
// }
if( FgAutoOn ) /* auto function */
{
FgAutoOn = 0;
#if BLUE_AUTO
OsdEnable(0);
OsdClearAll(); /* OSD control register data */
OsdMenuItem(L3_AUTO_ADJUST);
ZuracWriteByte(0x04,0x12); /* Flush Screen to blue */
OsdWrite(0xC3,0x20);
OsdOpenUp();
#endif
// MUTEEnable();
ZuracAutoFreeRun(1); //tonny
EepromColorRecall(ColorTemp);
if(!FgChangeAuto)
{
OsdShowMessage(AUTO_MESSAGE); //L3_AUTO_ADJUST
OSDNumber=L3_AUTO_ADJUST;
}
if( autofunction( FgAutoAdj ) ) // This segment mask by vincent shu
{
ModeInfo &= 0x7F;
if ( (MuteTimer==0) && (FgModeDetect==0) ) //algu 1130
EepromTimingStore( ModeCounter ); /* save Hpos,Vpos,Phase,Clock */
}
ZuracAutoFreeRun(0); //tonny
OsdEnable( 0 );
MUTEDisable();
#if BLUE_AUTO
ZuracWriteByte(0x04,0x00); /* Flush Screen to blank */
#endif
if(FgChangeAuto)
FgChangeAuto=0;
else if(FgAutoKeyFlag)
{
FgOsdAct = 0;
OSDNumber = L0_NOOSD;
FgAutoKeyFlag = 0;
}
else
{
FgOsdAct=1;
OSDNumber=L0_MENU0;
OSDMenuPage=L0_MENU0;
OSDPoint=0;
FgMenuChange=1;
OsdShowWindowA();
OsdHandler();
}
}
if( FgAdcAct ) /* adc adjust */
{
ADC9884(ModeCounter);
FgAdcAct = 0;
}
if( FgScalerAct ) /* Zurac scaler adjust */
{
Ttfc(ModeCounter,(Byte)FgScalerAdj);
FgScalerAct = 0;
FgScalerAdj = 0;
}
/*******************************************************************/
/*******************************************************************/
// if(( FgPowerStby || FgOverRange ) && PromptTimer == 0 )
//algu 1129 check DPMS message
if ( FgShowBurnin==0 && FgPowerStby==0 && PromptTimer==0 ) //&& (OSDNumber==L9_NOOSD || OSDNumber==L9_OVERRANGE || OSDNumber==L3_NO_SIGNAL || OSDNumber==L3_OVERRANGE) )
{
switch(OSDNumber)
{
case L9_NOOSD:
if ( VGA_DET== 0 )
{
OSDNumber=L3_NO_SIGNAL;
}
else
{
ZuracFreeRun(L0_NO_SIGNAL);
OsdShowMessage(CHECK_SIGNAL_MESSAGE);
if (FgBurnin)
PromptTimer = TIME_3SEC;
else
PromptTimer = TIME_90SEC;
}
break;
case L9_OVERRANGE:
// OsdEnable(0);
ZuracFreeRun(L0_OVERRANGE);
FgNoSignal=0; //algu 1130 This is must,beacuse ZuracFreeRun() set FgNoSignal=1.
OsdShowMessage(OVER_RANGE_MESSAGE);
// OSDNumber=L3_OVERRANGE;
if (FgBurnin)
PromptTimer = TIME_3SEC;
else
PromptTimer = TIME_25SEC;
break;
case L9_UNKNOWN_MODE:
ZuracFreeRun( L3_UNKNOWN_MODE );
FgNoSignal=0;
OsdShowMessage(UNKNOW_MESSAGE);
break;
case L9_FAILSAFE :
OsdShowMessage(FAILSAFE_MESSAGE);
OSDNumber=L3_FAILSAFE;
break;
case L3_NO_SIGNAL:
ZuracFreeRun(L0_NO_SIGNAL); //algu 1129
OsdShowMessage(POWER_SAVE_MESSAGE);
OSDNumber=L0_NO_SIGNAL;
if (FgBurnin)
PromptTimer = TIME_3SEC;
else
PromptTimer = TIME_5SEC;
break;
// case L3_OVERRANGE:
// OsdShowMessage(POWER_SAVE_MESSAGE);
// OSDNumber=L0_OVERRANGE;
// if (FgBurnin)
// PromptTimer = TIME_3SEC;
// else
// PromptTimer = TIME_5SEC;
// break;
case L0_NO_SIGNAL:
if ( FgBurnin && FgPowerBurnin )
{
FgShowBurnin=1;
OSDMaxValue=4;
OsdEnable(0);
OSDNumber=L0_NO_SIGNAL;
// if( FgPowerStby ) //algu 1130
// {
// SystemPowerOn();
// PowerLedPower(1); // off Power-LED
// PowerLedSleep(0); // off Sleep-LED
// FgPowerOff = 0;
// FgPowerStby = 0;
// FgFreeRun = 0;
// }
break;
}
case L0_OVERRANGE:
SystemStandBy();
break;
}
}
/*
if( FgPowerStby && PromptTimer == 0 )
{
PowerBacklight(0); // Backlight power-off
PowerPanel(0); // Panel power-off
PowerScaler(0); // Zurac power-off
PowerAdc(0); // ADC power-off
PowerDpms(0); // DPMS System-power-on
LEDSLEEP_PIN = 1;
LEDPOWER_PIN = 0;
// if(FgOverRange)
// FgPowerStby=1;
}
*/
// if( FgShowBurnin && (PromptTimer==0)) //buin start
// {
// OsdEnable(0);
// PromptTimer = TIME_3MIN;
// }
//algu 1122 burnin
if( FgShowBurnin && FgNoSignal && (FgPowerStby==0) && (PromptTimer==0) )
{
OSDMaxValue++;
OSDMaxValue = OSDMaxValue % 5;
if ( OSDMaxValue==0 )
{
ZuracWriteByte(0x04,BACK_WHITE);
}
else if ( OSDMaxValue==1 )
{
ZuracWriteByte(0x04,BACK_RED);
}
else
{
ZuracWriteByte(0x04,0x18-OSDMaxValue*2);
}
PromptTimer = TIME_5SEC;
LEDPOWER_PIN = 0;
LEDSLEEP_PIN = 1;
// LEDSLEEP_PIN = !LEDSLEEP_PIN;
// LEDPOWER_PIN = !LEDPOWER_PIN;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -