用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
956 B

5 months ago
#ifndef __MPUIIC_H
#define __MPUIIC_H
#include "sys.h"
//IO<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define MPU_SDA_IN() {GPIOC->CRH&=0XFFFF0FFF;GPIOC->CRH|=8<<12;}
#define MPU_SDA_OUT() {GPIOC->CRH&=0XFFFF0FFF;GPIOC->CRH|=3<<12;}
//IO<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define MPU_IIC_SCL PCout(12) //SCL
#define MPU_IIC_SDA PCout(11) //SDA
#define MPU_READ_SDA PCin(11) //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>SDA
//IIC<EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void MPU_IIC_Delay(void); //MPU IIC<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void MPU_IIC_Init(void); //<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>IIC<EFBFBD><EFBFBD>IO<EFBFBD><EFBFBD>
void MPU_IIC_Start(void); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IIC<EFBFBD><EFBFBD>ʼ<EFBFBD>ź<EFBFBD>
void MPU_IIC_Stop(void); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IICֹͣ<EFBFBD>ź<EFBFBD>
void MPU_IIC_Send_Byte(u8 txd); //IIC<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
u8 MPU_IIC_Read_Byte(unsigned char ack);//IIC<EFBFBD><EFBFBD>ȡһ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
u8 MPU_IIC_Wait_Ack(void); //IIC<EFBFBD>ȴ<EFBFBD>ACK<EFBFBD>ź<EFBFBD>
void MPU_IIC_Ack(void); //IIC<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ACK<EFBFBD>ź<EFBFBD>
void MPU_IIC_NAck(void); //IIC<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ACK<EFBFBD>ź<EFBFBD>
void IMPU_IC_Write_One_Byte(u8 daddr,u8 addr,u8 data);
u8 MPU_IIC_Read_One_Byte(u8 daddr,u8 addr);
#endif