16_I2C库函数
I2C库函数
1.void I2C_DeInit(I2C_TypeDef* I2Cx); 2.void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct); 3.void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct); 4.void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState); 5.void I2C_DMACmd(I2C_TypeDef* I2Cx, FunctionalState NewState); 6.void I2C_DMALastTransferCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); 7.void I2C_GenerateSTART(I2C_TypeDef* I2Cx, FunctionalState NewState); 生成起始条件 8.void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState); 生产终止条件 9.void I2C_AcknowledgeConfig(I2C_TypeDef* I2Cx, FunctionalState NewState); 应答使能,配置收到一个字节后,是否给从机应答,ACK为1,给从机应答,ACK为0,不给从机应答 10.void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, uint8_t Address); 11.void I2C_DualAddressCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); 12.void I2C_GeneralCallCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); 13.void I2C_ITConfig(I2C_TypeDef* I2Cx, uint16_t I2C_IT, FunctionalState NewState); 14.void I2C_SendData(I2C_TypeDef* I2Cx, uint8_t Data); 发送数据,即写数据到数据寄存器DR 15.uint8_t I2C_ReceiveData(I2C_TypeDef* I2Cx); 读取DR数据,作为返回值 16.void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, uint8_t Address, uint8_t I2C_Direction); 发送7位地址的专用函数 17.uint16_t I2C_ReadRegister(I2C_TypeDef* I2Cx, uint8_t I2C_Register); 18.void I2C_SoftwareResetCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); 19.void I2C_NACKPositionConfig(I2C_TypeDef* I2Cx, uint16_t I2C_NACKPosition); 20.void I2C_SMBusAlertConfig(I2C_TypeDef* I2Cx, uint16_t I2C_SMBusAlert); 21.void I2C_TransmitPEC(I2C_TypeDef* I2Cx, FunctionalState NewState); 22.void I2C_PECPositionConfig(I2C_TypeDef* I2Cx, uint16_t I2C_PECPosition); 23.void I2C_CalculatePEC(I2C_TypeDef* I2Cx, FunctionalState NewState); 24.uint8_t I2C_GetPEC(I2C_TypeDef* I2Cx); 25.void I2C_ARPCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); 26.void I2C_StretchClockCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); 27.void I2C_FastModeDutyCycleConfig(I2C_TypeDef* I2Cx, uint16_t I2C_DutyCycle);
FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, uint32_t I2C_FLAG); 读取标志位 void I2C_ClearFlag(I2C_TypeDef* I2Cx, uint32_t I2C_FLAG); 清除标志位 ITStatus I2C_GetITStatus(I2C_TypeDef* I2Cx, uint32_t I2C_IT); 读取中断标志位 void I2C_ClearITPendingBit(I2C_TypeDef* I2Cx, uint32_t I2C_IT); 清除中断标志位
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/798171.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!