iic.h

来自「电表解决方案概要power_meter_r8c2g_source_code」· C头文件 代码 · 共 38 行

H
38
字号
/**************************************************************
* *
* File Name : Iic_bus.h *
* Contents : IIC Bus Definition file *
* Copyright : RENESAS TECHNOLOGY CORPORATION *
* AND RENESAS SOLUTIONS CORPORATION *
* Version : 1.0 *
* note : *
* *
**************************************************************/

#define ACK 0				/* 发送应答数据位 */
#define NOACK 1				/* 不发送应答数据位 */
#define WRITE_MODE 0		/* 写请求 */
#define READ_MODE 1			/* 读请求 */

typedef unsigned char uchar;

/* EEPROM 读写协议操作结构体 */
typedef struct {            
	
	unsigned char iic_DeviceAddress;
	unsigned char iic_MemoryAddress;
	unsigned char *iic_Data;
	unsigned char iic_NumberOfByte;

}IicPack;

void initIicBus(void);							/* I2C 总线初始化 */

unsigned char IicBusRead(IicPack *);			/* I2C 总线写命令 */
unsigned char IicBusWrite(IicPack *);			/* I2C 总线读命令 */

void StartCondition(void);			/* I2C 开始状态请求 */
void StopCondition(void);			/* I2C 结束状态请求 */

unsigned char ByteWrite(unsigned char);					/* I2C 写字节命令 */
void ByteRead (unsigned char *, unsigned char);			/* I2C 读字节命令 */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?