📄 i2c.h
字号:
//**********************************************************************************************************
// The Software is proprietary, confidential, and valuable to Realtek Semiconductor
// Corporation ("Realtek"). All rights, including but not limited to copyrights,
// patents, trademarks, trade secrets, mask work rights, and other similar rights and interests,
// are reserved to Realtek. Without prior written consent from Realtek, copying, reproduction,
// modification, distribution, or otherwise is strictly prohibited. The Software shall be
// kept strictly in confidence, and shall not be disclosed to or otherwise accessed by
// any third party. @ <2003> - <2008> The Software is provided "AS IS" without any warranty of any kind,
// express, implied, statutory or otherwise.
//**********************************************************************************************************
//----------------------------------------------------------------------------------------------------
// ID Code : I2c.h No.0000
// Update Note :
//----------------------------------------------------------------------------------------------------
//--------------------------------------------------
// Definitions of I2c.c
//--------------------------------------------------
#define _I2C_WRITE_SIZE 16
#define _I2C_TIMEOUT_LIMIT 255
#define _I2C_BUSY 0
#define _I2C_OK 1
#define _I2C_WR 0
#define _I2C_RD 1
//----------------------------------------------------------------------------------------------------
#ifdef __I2C__
//--------------------------------------------------
// Global Variables
//--------------------------------------------------
#if(_TOUCH_SENSOR == _ON)
bit bTouchKeyFlag = 0;
#endif
//--------------------------------------------------
// Function Prototypes
//--------------------------------------------------
void Delay5us(void);
BYTE CI2cStart(BYTE ucDeviceAddr);
void CI2cStop(void);
BYTE CI2cGetAck(void);
void CI2cSendAck(void);
BYTE CI2cSendByte(BYTE ucValue);
BYTE CI2cGetByte(void);
bit CI2cRead(BYTE ucDeviceAddr, BYTE ucStartAddr, WORD usLength, BYTE *pReadArray);
bit CI2cWrite(BYTE ucDeviceAddr, BYTE ucStartAddr, WORD usLength, BYTE *pWriteArray);
#else
//--------------------------------------------------
// Extern Global Variables
//--------------------------------------------------
#if(_TOUCH_SENSOR == _ON)
extern bit bTouchKeyFlag;
#endif
//--------------------------------------------------
// Extern Function Prototypes
//--------------------------------------------------
extern void CI2cSendNoAck(void);
extern void Delay5us(void);
extern BYTE CI2cStart(BYTE ucDeviceAddr);
extern void CI2cStop(void);
extern BYTE CI2cGetAck(void);
extern void CI2cSendAck(void);
extern BYTE CI2cSendByte(BYTE ucValue);
extern BYTE CI2cGetByte(void);
extern bit CI2cRead(BYTE ucDeviceAddr, BYTE ucStartAddr, WORD usLength, BYTE *pReadArray);
extern bit CI2cWrite(BYTE ucDeviceAddr, BYTE ucStartAddr, WORD usLength, BYTE *pWriteArray);
#endif
//----------------------------------------------------------------------------------------------------
//--------------------------------------------------
// Macro of I2c.c
//--------------------------------------------------
#define SETI2CSDA() (bI2CSDA = _TRUE)
#define CLRI2CSDA() (bI2CSDA = _FALSE)
#define CHECKI2CSDA() (bI2CSDA)
#define SETI2CSCL() (bI2CSCL = _TRUE)
#define CLRI2CSCL() (bI2CSCL = _FALSE)
#define CHECKI2CSCL() (bI2CSCL)
//--------------------------------------------------
// Macro of Touch Key I2C Bus
//--------------------------------------------------
#if(_TOUCH_SENSOR == _ON)
#define SETI2CSDA_TOUCH_KEY() (bTOUCHSDA= _TRUE)
#define CLRI2CSDA_TOUCH_KEY() (bTOUCHSDA= _FALSE)
#define CHECKI2CSDA_TOUCH_KEY() (bTOUCHSDA)
#define CLRI2CSCL_TOUCH_KEY() (bTOUCHSCL= _FALSE)
#define CHECKI2CSCL_TOUCH_KEY() (bTOUCHSCL)
#define GET_I2C_TOUCH_KEY() ((bit)(bTouchKeyFlag & _BIT0))
#define SET_I2C_TOUCH_KEY() (bTouchKeyFlag |= _BIT0)
#define CLR_I2C_TOUCH_KEY() (bTouchKeyFlag &=0x00)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -