文件名称:STM8软件IIC代码
文件大小:6KB
文件格式:TXT
更新时间:2016-09-01 08:56:09
STM8 I2C
#define I2C_PIN GPIOE #define I2C_SCL GPIO_PIN_1 #define I2C_SDA GPIO_PIN_2 #define Set_I2C_SCL_HIGHT GPIO_WriteHigh(I2C_PIN, I2C_SCL) #define Set_I2C_SCL_LOW GPIO_WriteLow(I2C_PIN, I2C_SCL) #define Set_I2C_SDA_HIGHT GPIO_WriteHigh(I2C_PIN, I2C_SDA) #define Set_I2C_SDA_LOW GPIO_WriteLow(I2C_PIN, I2C_SDA) #define Get_I2C_SDA GPIO_ReadInputPin(I2C_PIN, I2C_SDA) #define Set_I2C_SCL_Out GPIO_Init(I2C_PIN, I2C_SCL, GPIO_MODE_OUT_PP_HIGH_FAST) #define Set_I2C_SDA_Out GPIO_Init(I2C_PIN, I2C_SDA, GPIO_MODE_OUT_PP_HIGH_FAST) #define Set_I2C_SDA_In GPIO_Init(I2C_PIN, I2C_SDA, GPIO_MODE_IN_FL_NO_IT)