1 /*
2  * Copyright (c) 2006-2023, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author           Notes
8  * 2023/12/01     Raman Gopalan    First version
9  */
10 
11 #ifndef __DRV_SOFT_I2C__
12 #define __DRV_SOFT_I2C__
13 
14 #include <rtdevice.h>
15 #include "drv_gpio.h"
16 #include "gpio.h"
17 
18 #ifdef BSP_USING_SOFT_I2C
19 /* AVR32 software I2C driver class */
20 struct avr32_i2c
21 {
22     struct rt_i2c_bit_ops ops;
23     struct rt_i2c_bus_device i2c_bus;
24 };
25 
26 /* AVR32 config class */
27 struct avr32_soft_i2c_config
28 {
29     rt_uint8_t scl;
30     rt_uint8_t sda;
31     const char *bus_name;
32 };
33 
34 #ifdef BSP_USING_SOFT_I2C1
35 #define I2C1_BUS_CONFIG                                  \
36     {                                                    \
37         .scl = BSP_SOFT_I2C1_SCL_PIN,                    \
38         .sda = BSP_SOFT_I2C1_SDA_PIN,                    \
39         .bus_name = "i2c1",                              \
40     }
41 #endif
42 
43 int rt_sw_i2c_init(void);
44 
45 #endif /* BSP_USING_SOFT_I2C */
46 #endif /* #ifndef __DRV_SOFT_I2C__ */
47