1 /* 2 * Copyright (c) 2006-2024 RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2022-07-20 Rbb666 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 /* ifx config class */ 19 struct ifx_soft_i2c_config 20 { 21 rt_uint8_t scl; 22 rt_uint8_t sda; 23 const char *bus_name; 24 }; 25 /* ifx i2c dirver class */ 26 struct ifx_i2c 27 { 28 struct rt_i2c_bit_ops ops; 29 struct rt_i2c_bus_device i2c_bus; 30 }; 31 32 #ifdef BSP_USING_I2C1 33 #define I2C1_BUS_CONFIG \ 34 { \ 35 .scl = BSP_I2C1_SCL_PIN, \ 36 .sda = BSP_I2C1_SDA_PIN, \ 37 .bus_name = "i2c1", \ 38 } 39 #endif 40 41 int rt_hw_i2c_init(void); 42 43 #endif 44