-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathi2c_jk.h
43 lines (32 loc) · 900 Bytes
/
i2c_jk.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
43
#ifndef __I2C_MASTER_JKK_H__
#define __I2C_MASTER_JKK_H__
#include "c_types.h"
#if 0
#define I2C_MASTER_GPIO_SET(pin) \
gpio_output_set(1<<pin,0,1<<pin,0)
#define I2C_MASTER_GPIO_CLR(pin) \
gpio_output_set(0,1<<pin,1<<pin,0)
#define I2C_MASTER_GPIO_OUT(pin,val) \
if(val) I2C_MASTER_GPIO_SET(pin);\
else I2C_MASTER_GPIO_CLR(pin)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
void i2c_master_gpio_init(uint8_t sda, uint8_t sck);
void i2c_master_init(void);
#define i2c_master_wait os_delay_us
void i2c_master_stop(void);
void i2c_master_start(void);
void i2c_master_setAck(uint8 level);
uint8 i2c_master_getAck(void);
uint8 i2c_master_readByte(void);
void i2c_master_writeByte(uint8 wrdata);
bool i2c_master_checkAck(void);
void i2c_master_send_ack(void);
void i2c_master_send_nack(void);
#ifdef __cplusplus
}
#endif /* End of CPP guard */
#endif //__I2C_MASTER_JKK_H__