-
Notifications
You must be signed in to change notification settings - Fork 0
/
i2c.h
42 lines (35 loc) · 1.13 KB
/
i2c.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef __I2C__
#define __I2C__
#ifdef __cplusplus
extern "C" {
#endif
#include "stm32f10x.h"
#define ErrTemperature (-100)
#ifndef false
#define false FALSE
#endif
#ifndef true
#define true TRUE
#endif
typedef enum {
FALSE = 0, TRUE = !FALSE
} boole;
//---------------------------
void I2C_init(void);
void SoftDelay_us(vu32 count);
void AM2321_Start(unsigned int am2321_addr);//AM2321 启动
void I2C_start(void);// I2C启动
void I2C_stop(void);// I2C停止
void I2C_Rec_Ack(void);// I2C 主接受,继续操作,确认应答
void I2C_End_Ack(void);// I2C 主接受,结束操作,确认应答
boole I2C_Test_Ack(void);// I2C 从接受确认应答
unsigned char I2C_receive(void); //I2C接受 数据从高位到低位
void I2C_send(unsigned char I2C_data); // I2C发送
boole I2C_Read(unsigned char I2C_Addr, unsigned char *pData, unsigned char Len); // I2C 连续读Len字节
boole I2C_Write(unsigned char I2C_Addr, unsigned char Fun_Data, unsigned char *pData, unsigned char Len);
/**************************************************/
/**************************************************/
#ifdef __cplusplus
}
#endif
#endif// __I2C__