📄 i2c.h
字号:
#ifndef H_I2C
#define H_I2C
#include "gen_types.h"
/* exported definitions */
typedef enum
{
I2C_OK = 0, /* I2C transmission OK */
I2C_NOSDA, /* SDA line is stucked */
I2C_NOSCL, /* SCL line is stucked */
I2C_BUSERROR, /* SDA and SCL are stucked */
I2C_NOACK /* SDA and SCL lines are OK but the device does not acknowledge */
} I2C_RESULT;
typedef enum
{
I2C_READ, /* Read from slave */
I2C_WRITE, /* Write to slave */
I2C_WRITENOSTOP /* Write to slave without stop */
} I2C_MODE;
/* exported functions */
void I2cInit(U16 BaseAddress, U32 tempo); /* Init I2C transmission */
I2C_RESULT I2cReadWrite(I2C_MODE mode,unsigned char ChipAddress,unsigned char *Data,int NbData); /* Read or write bytes */
void I2cTerm(void); /* Terminate I2C transmission */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -