📄 1574main.c
字号:
I2C_WriteByte(L44_WRID, 0x11, 0xFa); //enable gamma table
while(1)
{
/* cdv_3Astatus = CVD1_ReadWrite(0x00, 0x3A, 0x00) & 0x0E; // read CVD1 status: chroma PLL/V/H line lock
cdv_3Cstatus = CVD1_ReadWrite(0x00, 0x3C, 0x00) & 0x04; // 625 scan line detected
//Check is Composite input CH# and CDV signal is not LOCK
if (dig_cvd && cdv_3Astatus!=0x0E)
{
NTSC_PAL = cdv_3Cstatus;
if (!show_type)
{
OSD_ShowTitle(ch_type, 13);
show_type = 1;
}
I2C_WriteByte(L44_WRID, 0x20, 0xC0); //Turn OFF Screen
if (cdv_3Cstatus) // PAL system input
{
{
for (i=0; i<WR_CVD1_BYTE; i++) // set reg for PAL input
CVD1_ReadWrite(0x01, CVD1_PALTab[i*2], CVD1_PALTab[i*2+1]);
strcpy(&ch_type[8], "PAL ");
}
// if (CBSH_Value[6]) //Turn ON the Edge filter
CVD1_ReadWrite(0x01, 0x01, 0x08);
I2C_WriteByte(L44_WRID, 0x71, 0xA3);
I2C_WriteByte(L44_WRID, 0x68, 0x19);//74
set_times &= 0x07;
}
else // NTSC system input
{
if (set_times++ < 3)
{
for (i=0; i<WR_CVD1_BYTE; i++)
CVD1_ReadWrite(0x01, CVD1_NTSCTab[i*2], CVD1_NTSCTab[i*2+1]);
strcpy(&ch_type[8], "NTSC ");
}
else
{ //PAL M mode
for (i=0; i<WR_CVD1_BYTE; i++)
CVD1_ReadWrite(0x01, CVD1_PALMTab[i*2], CVD1_PALMTab[i*2+1]);
strcpy(&ch_type[8], "PAL M");
}
if (CBSH_Value[6]) //Turn ON the Edge filter
CVD1_ReadWrite(0x01, 0x01, 0x09);
set_times &= 0x07;
}
Adj_DisplayMode(CBSH_Value[7]);
}
else
{
if (show_type)
{
I2C_WriteByte(L44_WRID, 0x20, 0x40); //Turn ON Screen //***
if (dig_cvd)
OSD_ShowTitle(ch_type, 13);
show_type = 0;
}
}
*/ key = WaitKey();
if (key == ENTER) //Switch Input CH# CCIR / Composite 1,2,3
{
// if (++dig_cvd > 3) dig_cvd = 0;
// Adj_DisplayMode(CBSH_Value[7]);
if (dig_cvd)
{
// if (dig_cvd == 1) CVD1_ReadWrite(0x01, 0x90, 0x00); //CH#1
// if (dig_cvd == 2) CVD1_ReadWrite(0x01, 0x90, 0x40); //CH#2
if (dig_cvd == 3) CVD1_ReadWrite(0x01, 0x90, 0x80); //CH#3
dig_cvd = 0;
I2C_WriteByte(L44_WRID, 0x00, 0x41); //Switch to CVD1
// ch_type[5] = dig_cvd | 0x30;
strcpy(ch_type, "VIDEO 3 NTSC ");
OSD_ShowTitle(ch_type, 13);
I2C_WriteByte(L44_WRID, 0x11, 0xF4); //access gamma table
for(j=0; j<768; j++)
{
i= GAMMATAL[j];
I2C_WriteByte(L44_WRID, 0x1B, i); //R
// I2C_WriteByte(L44_WRID, 0x1B, i); //G
// I2C_WriteByte(L44_WRID, 0x1B, i); //B
}
I2C_WriteByte(L44_WRID, 0x11, 0xFa); //enable gamma table
I2C_WriteByte(L44_WRID, 0x15, 0x80);
I2C_WriteByte(L44_WRID, 0x13, 0x80);
I2C_WriteByte(L44_WRID, 0x17, 0x80);
}
else
{
NTSC_PAL = 0x00;
// I2C_WriteByte(L44_WRID, 0x68, 0x10);
dig_cvd = 1;
// I2C_WriteByte(L44_WRID, 0x00, 0x50); //Switch to CCIR 601
I2C_WriteByte(L44_WRID, 0x00, 0x80); //Switch to CCIR 656
strcpy(ch_type, "CCIR601 NTSC ");
OSD_ShowTitle(ch_type, 13);
I2C_WriteByte(L44_WRID, 0x11, 0xF4); //access gamma table
for(j=0; j<768; j++)
{
i= GAMMATAL2[j];
I2C_WriteByte(L44_WRID, 0x1B, i); //R
// I2C_WriteByte(L44_WRID, 0x1B, i); //G
// I2C_WriteByte(L44_WRID, 0x1B, i); //B
}
I2C_WriteByte(L44_WRID, 0x11, 0xFa); //enable gamma table
I2C_WriteByte(L44_WRID, 0x15, 0x90);
I2C_WriteByte(L44_WRID, 0x13, 0x8a);
I2C_WriteByte(L44_WRID, 0x17, 0x80);
}
}
if (key == MENU)
Adj_CBSH();
}
}
/**--------------------------------------------------------------------------
* Name BYTE WaitKey()
*
* Description There are 2 working item in this function
* 1. Detect the UART Flag for RS-232 parse process
*
* 2. Detect and return whick key press and release
* Press key Return code 8051 Port
* ----------------------------------------------
* Enter 0x1E P0.0
* DOWN 0x1B P0.2
* UP 0x17 P0.3
* MENU 0x0F P0.4
*
* Not press 0x00
*
* Flow Chart
*
* Return press_key
*
* DATE Author Description
* ===========================================================================
* 2004-07-10 K.M. Ho This is first time implement
*/
BYTE WaitKey(void)
{
BYTE press_key;
press_key = P0 & 0x1F; // get press key from Port#0
//***************************************
//--- Process the UART service -----
//***************************************
if (UARTFlag & RX_PARSE) //service the parse
UART_ParseFun(); //Jump into UART_ParseFun() function
//***********************************
//--- Process The 15xx Key -----
//***********************************
if (press_key != 0x1F)
{
for (;;) //wait all key release
if ((P0&0x1F)==0x1F)
break;
T0_0Interval = 500; //reset the Timer interval 10sec.
//P2 ^= ~(press_key|0xE0);
}
else
press_key = 0;
return (press_key); //if not press key will return 0x00
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -