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 * 2024-4-1 IceBear003 the first version 9 */ 10 11 #ifndef __DRV_I2C_H_ 12 #define __DRV_I2C_H_ 13 14 #include <rtthread.h> 15 #include <rtdevice.h> 16 17 struct i2c_bus_device 18 { 19 struct rt_i2c_bus_device parent; 20 I2C_TypeDef *periph; 21 }; 22 23 struct i2c_config 24 { 25 rt_uint32_t clock_speed; 26 uint16_t duty_cycle; 27 uint16_t own_address; 28 uint8_t enable_ack; 29 uint8_t is_7_bit_address; 30 }; 31 32 struct i2c_config i2c_default_conf={5000, I2C_Mode_I2C, I2C_DutyCycle_2, 0, I2C_Ack_Disable, I2C_AcknowledgedAddress_7bit}; 33 34 int rt_hw_i2c_init(struct i2c_config *config); 35 36 #endif