📄 i2c.h
字号:
/********************************************************************
* PPC885 I2C Function *
********************************************************************/
#ifndef INCi2ch
#define INCi2ch
#include "vxWorks.h"
#include "drv/sio/ppc860Sio.h"
typedef struct { /* I2C_BUF */
VUINT16 statusMode; /* status and control */
VUINT16 dataLength; /* length of data buffer in bytes */
u_char *dataPointer; /* points to data buffer */
} I2C_BUF;
typedef struct {
I2C_PARAM *i2cParam;
I2C_BUF *i2cRxBuf;
I2C_BUF *i2cTxBuf;
} I2C_DEV;
typedef struct {
UCHAR seconds;
UCHAR minutes;
UCHAR hours;
UCHAR day;
UCHAR date;
UCHAR month;
UCHAR year;
} RTC_TIME;
typedef struct {
UCHAR secondReg;
UCHAR minuteReg;
UCHAR hourReg;
UCHAR dayReg;
UCHAR dateReg;
UCHAR monthReg;
UCHAR yearReg;
} RTC_REGS;
STATUS readAddrVerify(UCHAR deviceAddr);
STATUS writeAddrVerify(UCHAR deviceAddr);
STATUS I2cInit(void);
STATUS eepromWriteEnable(void);
STATUS eepromWriteDisable(void);
STATUS eepromByteWrite(UCHAR deviceAddr, UCHAR wordAddrH, UCHAR wordAddrL, char data);
STATUS eepromPageWrite(UCHAR deviceAddr, int pageNum, UCHAR offset, char *buf, int number);
STATUS eepromCurrentRead(UCHAR deviceAddr, char *data);
STATUS eepromRandomRead (UCHAR deviceAddr, UCHAR worddAddrH, UCHAR wordAddrL, char *data);
STATUS eepromSequenceRead(UCHAR deviceAddr, UCHAR wordAddrH, UCHAR wordAddrL, char *buf, int number);
STATUS rtcWrite(UCHAR deviceAddr, UCHAR wordAddr, char *buf, int number);
STATUS rtcRead(UCHAR deviceAddr, UCHAR wordAddr, char *buf, int number);
STATUS rtcInit(void);
STATUS rtcTimeGet(RTC_TIME *rtcTime);
STATUS rtcTimeSet(RTC_TIME *rtcTime);
#endif /* INCi2ch */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -