📄 twowire.h
字号:
//---------------------------------------------------------------------------
// Terawins Inc. Company Confidential Strictly Private
//
// $Archive: TwoWire.h $
// $Revision: 1.01 $
// $Author: JoannW $
// $Date: 2002/10/15 $
//
// --------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------------------------
// Copyright 2002(c) Terawins Inc.
// This is an unpublished work.
// --------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>> WARRANTEE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------------------------
#ifndef __TWOWIREPARMS_H__
#define __TWOWIREPARMS_H__
//#define TWO_TW_BUS
uCHAR I2CWriteByte (uCHAR cDevAddr, uCHAR cReg, uCHAR cData);
uCHAR I2CReadByte (uCHAR cDevAddr, uCHAR cReg);
// Burst Mode Functions
uCHAR twdWr_Burst_A (uCHAR cReg);
//uCHAR twdWr_Burst_D (uCHAR cReg);
void twdWr_Burst_D (uCHAR cReg);
void twdWr_Burst_P (void);
BOOL twdWriteTable(uCHAR cDevAddr, char *pString);
BOOL I2CWriteBytes(uCHAR cDevAddr, uCHAR cReg, uCHAR cNum, unsigned char *cData);
BOOL I2CReadBytes(uCHAR cDevAddr, uCHAR cReg, uCHAR *pString, uCHAR cNum);
void twdDelay (uWORD wLoops);
void OSDCfgWr(uCHAR index,uCHAR dat);
#ifdef TV// TV_AVAILABLE
//16Bits IIC
uCHAR TunerReadByte(uCHAR cDevAddr); //uCHAR cReg)
uCHAR TunerWriteByte(uCHAR cDevAddr, uCHAR cDecH, uCHAR cDecL, uCHAR cData);
#endif
//Define TW702 Device default address
#define TW101 0x50
#define TW515 0xB8
#define PT2313 0x88
#define EEPBLOCK0 0xA0
#define EEPBLOCK1 0xA2
#define EEPBLOCK2 0xA4
#define EEPBLOCK3 0xA6
#define EEPBLOCK4 0xA8
#define EEPBLOCK5 0xAA
#define EEPBLOCK6 0xAC
#define EEPBLOCK7 0xAE
#define EEPVIDEOBLOCK 0xA0
#define EEPTVBLOCK 0xA8
#ifndef TWO_TW_BUS
sbit SDA = P1^7; //P0^0;
sbit SCL = P1^6; //P0^1;
//sbit SDA = P0^0;
//sbit SCL = P0^1;
#define Set_SDA2High SDA = 1
#define Set_SDA2Low SDA = 0
#define Set_SCL2High SCL = 1
#define Set_SCL2Low SCL = 0
#define Set_SDA_High SDA = 1,SDA = 1
#define Set_SDA_Low SDA = 0,SDA = 0
#define Set_SCL_High SCL = 1,SCL = 1
#define Set_SCL_Low SCL = 0,SCL = 0
/*
#define Set_SDA_High SDA = 1
#define Set_SDA_Low SDA = 0
#define Set_SCL_High SCL = 1
#define Set_SCL_Low SCL = 0
#define Set_SDA_High SDA = 1,SDA = 1
#define Set_SDA_Low SDA = 0,SDA = 0
#define Set_SCL_High SCL = 1,SCL = 1
#define Set_SCL_Low SCL = 0,SCL = 0
*/
#define SDA_High SDA!=0
#define SDA_Low SDA==0
#define SCL_High SCL!=0
#define SCL_Low SCL==0
#else //define TWO_TW_BUS
static bit gbTwBusSel = 1;
sbit SDA1 = P1^7;
sbit SCL1 = P1^6;
sbit SDA2 = P2^7;
sbit SCL2 = P2^6;
#define Set_SDA_High (gbTwBusSel) ? (SDA1 = 1) : (SDA2 = 1)
#define Set_SDA_Low (gbTwBusSel) ? (SDA1 = 0) : (SDA2 = 0)
#define Set_SCL_High (gbTwBusSel) ? (SCL1 = 1) : (SCL2 = 1)
#define Set_SCL_Low (gbTwBusSel) ? (SCL1 = 0) : (SCL2 = 0)
#define SDA_High (gbTwBusSel) ? (SDA1!=0 ) : (SDA2!=0 )
#define SDA_Low (gbTwBusSel) ? (SDA1==0 ) : (SDA2==0 )
#define SCL_High (gbTwBusSel) ? (SCL1!=0 ) : (SCL2!=0 )
#define SCL_Low (gbTwBusSel) ? (SCL1==0 ) : (SCL2==0 )
#endif
#define TWD_SPEED 0x01 //value: 1 (Fastest), 2 (slower), ... N (much slower)
#define TWD_LONG_TIME (TWD_SPEED*1)
#define TWD_SHORT_TIME (TWD_SPEED*1)
#endif // __TWOWIREPARMS_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -