Files
motor_controller2/my_software/iic.h
T
2021-10-25 00:33:34 +08:00

38 lines
862 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* iic.h
*
* Created on: Oct 24, 2021
* Author: wuwenfeng
*/
#ifndef IIC_H_
#define IIC_H_
#include "main.h"
//产生IIC起始信号
void IIC_Start(void);
//产生IIC停止信号
void IIC_Stop(void);
//等待应答信号到来
//返回值:1,接收应答失败
// 0,接收应答成功
uint8_t IIC_Wait_Ack(void);
//产生ACK应答
void IIC_Ack(void);
//不产生ACK应答
void IIC_NAck(void);
//IIC发送一个字节
//返回从机有无应答
//1,有应答
//0,无应答
void IIC_Send_Byte(uint8_t txd);
//读1个字节,ack=1时,发送ACKack=0,发送nACK
uint8_t IIC_Read_Byte(unsigned char ack);
void IIC_SAND_DATE(unsigned char DEVICE_ADD,unsigned char IN_DEVICE_ADD,char *DATAS,uint16_t LONG);
void IIC_READ_DATE(unsigned char DEVICE_ADD,unsigned char IN_DEVICE_ADD,char *DATAS,uint16_t LONG);
#endif /* IIC_H_ */