?? iccontrol.c
字號:
/*##########################################################################
# Terawins Inc. Company #
# Copyright (c) 2005, All rights reserved #
# #
# All rights reserved. Reproduction in whole or in parts is prohibited #
# without the prior written consent. #
##########################################################################*/
///////////////////////////////////////////////////////////////////////////////
// //
// LCD Application Firmware //
// ========================================================================== //
// //
// Module : ICControl //
// //
// Purpose : IC control functions //
// //
// Version : 1.00 //
// //
// Compiler : Keil 8051 C Compiler v7.5 //
// //
// Reference: [1] Keil C51 Compiler User's Guide 09.2001, Keil Software, Inc.//
// //
// ========================================================================== //
// //
// Date Author Reason (what and why) //
// ----------- ------------- ---------------------------------------------- //
// 2005/12/30 Kevin Hsu //
// //
////////////////////////////////////////////////////////////////////////////////
#include "Common.h"
#include "Global.h"
#include "ICControl.h"
#include "TWICreg.h"
#include "OSD2_Define.h"
#define BASEADDRESS 0x0000
void IC_WritByte(uWORD bPage, uCHAR bAdd, uCHAR bData)
{
uWORD Address = BASEADDRESS + bPage + bAdd;
T128Registers[Address]=bData;
twdDelay(1);
}
uCHAR IC_ReadByte(uWORD bPage, uCHAR bAdd)
{
uWORD Address = BASEADDRESS + bPage + bAdd;
return T128Registers[Address];
}
void twdDelay(uWORD wLoops)
{
uWORD wTemp;
while (wLoops--) {
wTemp = 20; // one loop below takes about 11 us
while (wTemp--)
{
wTemp=wTemp;
}
}
}
/* C L O S E P A N E L */
/*-------------------------------------------------------------------------
ignore and block the input vsync triggering the output vsync ,
display user define color in panel
-------------------------------------------------------------------------*/
void ClosePanel(uCHAR uR, uCHAR uG, uCHAR uB)
{
//IC_WritByte(TWIC_P1, 0xB8, IC_ReadByte(TWIC_P1,0xB8)&0x7F);
IC_WritByte(TWIC_P0, 0xC2, IC_ReadByte(TWIC_P0, 0xC2)|(PSYNC_STR|IGNORE_VSYNC));
IC_WritByte(TWIC_P0, 0x9d, uR);
IC_WritByte(TWIC_P0, 0x9e, uG);
IC_WritByte(TWIC_P0, 0x9f, uB);
IC_WritByte(TWIC_P0, PATTERN_CTRL, 0x87);//enable frame background color
IC_WritByte(TWIC_P0, 0xe2, 0x11); //enable registers shadow control,sync all shadow registers
m_bPanelClose=1;
}
void OpenPanel(void)
{
IC_WritByte(TWIC_P0, 0xC2, IC_ReadByte(TWIC_P0, 0xC2)&~(PSYNC_STR|IGNORE_VSYNC));
//IC_WritByte(TWIC_P1, 0xB8, IC_ReadByte(TWIC_P1,0xB8)|0x80);
IC_WritByte(TWIC_P0, PATTERN_CTRL, IC_ReadByte(TWIC_P0, PATTERN_CTRL)&~0x80); //Enable Frame Background Color
IC_WritByte(TWIC_P0, 0xe2, 0x11); //enable registers shadow control,sync all shadow registers
m_bPanelClose=0;
}
//~ OSD1 Config Register Setting ~//
void OSD1CfgSet(uCHAR index,uCHAR dat)
{
IC_WritByte(TWIC_P0,OSD_CFG_INDEX,index);
IC_WritByte(TWIC_P0,OSD_CFG_DATA,dat);
}
//~ OSD1 Target OSD Ram Setting. ~//
void OSD1SetRamAddr(uWORD address)
{
IC_WritByte(TWIC_P0,OSD_RAM_AH,(uCHAR)(address>>8));
IC_WritByte(TWIC_P0,OSD_RAM_AL,(uCHAR)(address & 0xff));
}
void OSD1SetRamData(uCHAR cdata)
{
IC_WritByte(TWIC_P0,OSD_RAM_DL,cdata);
//IC_WritByte(TWIC_P0,OSD_RAM_DL,(uCHAR)(wdata & 0xff));
//IC_WritByte(TWIC_P0,OSD_RAM_DH,(uCHAR)(wdata>>8));
}
// OSD2 config register Write
void OSD2CfgWr(uCHAR index,uCHAR dat)
{
IC_WritByte(TWIC_P0,OSD2_CFG_INDEX,index);
IC_WritByte(TWIC_P0,OSD2_CFG_DATA,dat);
}
void OSD2SetRamAddr(uWORD address)
{
IC_WritByte(TWIC_P0,OSD2_RAM_AL,(uCHAR)(address & 0xff));
IC_WritByte(TWIC_P0,OSD2_RAM_AH,(uCHAR)(address>>8));
}
void OSD2SetRamData(uWORD wdata)
{
IC_WritByte(TWIC_P0,OSD2_RAM_DL,(uCHAR)(wdata & 0xff));
IC_WritByte(TWIC_P0,OSD2_RAM_DH,(uCHAR)(wdata>>8));
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -