i2c.h

来自「ST7032i驱动应用实例(I2C接口)」· C头文件 代码 · 共 31 行

H
31
字号
// ------------------- head file for i2c.c -------------------------------------
#ifndef __LCD_I2C__
#define __LCD_I2C__

// ---------------- Pins' Definition of I2C Bus --------------------------------
#ifndef I2C_SCL
	#define I2C_SCL 0	// Serial Clock
	#define I2C_SDA 1	// Serial Data
	#define I2C_DataPort PORTB	// I2C data port
	#define I2C_DataPins PINB	// I2C data pins
#endif
// -----------------------------------------------------------------------------

#define I2C_DELAY	4	// Delay in Us for I2C Bus

// ------------------------ Function Prototypes --------------------------------
// Start an I2C communication
void I2C_Start(void);
// Stop an I2C Communication
void I2C_Stop(void);
// Send a byte to I2C Bus
void I2C_SendByte(uint8 dByte);
// Read a byte from the slave device
uint8 I2C_ReadByte(void);
// Send an ACK/NACK signal to the Slave device
void I2C_SendAck(uint8 ACK);
// -----------------------------------------------------------------------------

#include "i2c.c"
#endif

⌨️ 快捷键说明

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