📄 i2c.h
字号:
#ifndef _I2C_H#define _I2C_H/* GPIO Pin Definitions */#define I2C_SCL_CLR P0_0 = 0#define I2C_SCL_SET P0_0 = 1#define I2C_SDA_GET P0_1#define I2C_SDA_CLR P0_1 = 0#define I2C_SDA_SET P0_1 = 1/* I2C Data flow Direction Definitions */#define I2C_WRITE 0x00 /* Write Direction */#define I2C_READ 0x01 /* Read Direction *//* I2C Acknowledge Definitions */#define I2C_ACK 0#define I2C_NO_ACK 1/* I2C functions *//* Generate the start condition */void I2C_Start();/* Generate the stop condition */void I2C_Stop();/* Master send a byte to the slave device */void I2C_Send_Byte(unsigned char byte);/* Master send the slave address */void I2C_Send_Addr(unsigned char addr, unsigned char dir);/* Master send the data to the slave device */#define I2C_Send_data I2C_Send_Byte/* Master get a byte from the slave device */unsigned char I2C_Get_Byte(unsigned char last);/* Master get the data from the slave device */#define I2C_Get_data I2C_Get_Byte/* Hold the voltage level of the signal */#define I2C_NOP() _asm nop nop nop _endasm#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -