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/04/15 chushicheng first version 9 */ 10 11 #ifndef __DRV_I2C__ 12 #define __DRV_I2C__ 13 14 #include <rtthread.h> 15 #include <rthw.h> 16 #include <rtdevice.h> 17 18 /* bl i2c dirver class */ 19 struct bl_i2c 20 { 21 struct rt_i2c_bit_ops ops; 22 struct rt_i2c_bus_device i2c_bus; 23 }; 24 25 /* bl config class */ 26 struct bl_soft_i2c_config 27 { 28 rt_uint8_t scl; 29 rt_uint8_t sda; 30 const char *bus_name; 31 }; 32 33 #ifdef BSP_USING_SOFT_I2C1 34 #define I2C1_BUS_CONFIG \ 35 { \ 36 .scl = BSP_I2C1_SCL_PIN, \ 37 .sda = BSP_I2C1_SDA_PIN, \ 38 .bus_name = "i2c1", \ 39 } 40 #endif 41 42 int rt_hw_i2c_init(void); 43 44 #endif 45