1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2019-03-22     balanceTWK   first version
9  */
10 
11 #ifndef __DRV_SOFT_I2C__
12 #define __DRV_SOFT_I2C__
13 
14 #include <rtthread.h>
15 #include <rthw.h>
16 #include <rtdevice.h>
17 
18 /* w60x config class */
19 struct w60x_soft_i2c_config
20 {
21     rt_uint8_t scl;
22     rt_uint8_t sda;
23     const char *bus_name;
24 };
25 /* w60x i2c dirver class */
26 struct w60x_i2c
27 {
28     struct rt_i2c_bit_ops ops;
29     struct rt_i2c_bus_device i2c_bus;
30 };
31 
32 #ifdef BSP_USING_SOFT_I2C1
33 #define I2C1_BUS_CONFIG                                  \
34     {                                                    \
35         .scl = SOFT_I2C1_SCL_PIN,                        \
36         .sda = SOFT_I2C1_SDA_PIN,                        \
37         .bus_name = "i2c1soft",                          \
38     }
39 #endif
40 
41 #ifdef BSP_USING_SOFT_I2C2
42 #define I2C2_BUS_CONFIG                                  \
43     {                                                    \
44         .scl = SOFT_I2C2_SCL_PIN,                        \
45         .sda = SOFT_I2C2_SDA_PIN,                        \
46         .bus_name = "i2c2soft",                          \
47     }
48 #endif
49 
50 #ifdef BSP_USING_SOFT_I2C3
51 #define I2C3_BUS_CONFIG                                  \
52     {                                                    \
53         .scl = SOFT_I2C3_SCL_PIN,                        \
54         .sda = SOFT_I2C3_SDA_PIN,                        \
55         .bus_name = "i2c3soft",                          \
56     }
57 #endif
58 
59 int rt_hw_i2c_init(void);
60 
61 #endif
62