guowenxue
2021-08-29 77ddd4a0943e2f9935bec2e00fffacec370cc1aa
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
/**********************************************************************
*   Copyright: (C)2021 LingYun IoT System Studio <www.weike-iot.com>
*      Author: GuoWenxue<guowenxue@gmail.com> QQ: 281143292
* Description: BearKE1 NB-IoT Board GPIO simulate I2C bus source code
*
*   ChangeLog:
*        Version    Date       Author            Description
*        V1.0.0  2021.08.10  GuoWenxue      Release initial version
***********************************************************************/
 
#ifndef INC_GPIO_I2C_H_
#define INC_GPIO_I2C_H_
 
/* I2C Bus ERROR Number */
enum
{
  NO_ERROR       = 0x00, // no error
  PARM_ERROR     = 0x01, // parameter out of range error
  ACK_ERROR      = 0x02, // no acknowledgment error
  CHECKSUM_ERROR = 0x04, // checksum mismatch error
  TIMEOUT_ERROR  = 0x08, // timeout error
  BUS_ERROR      = 0x10, // bus busy
};
 
enum
{
    ACK_NONE, /* Without ACK/NAK Reply */
    ACK,      /* Reply with ACK */
    NAK,      /* Reply with NAK */
};
 
 
extern int I2C_Master_Receive(uint8_t addr, uint8_t *buf, int len);
 
extern int I2C_Master_Transmit(uint8_t addr, uint8_t *data, int bytes);
 
#endif /* INC_GPIO_I2C_H_ */