mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-30 05:10:26 +08:00
[drivers/i2c] optimize i2c driver framework
This commit is contained in:
parent
0c4e733737
commit
417efc370f
@ -77,9 +77,6 @@ static rt_err_t i2c_bus_device_control(rt_device_t dev,
|
|||||||
case RT_I2C_DEV_CTRL_10BIT:
|
case RT_I2C_DEV_CTRL_10BIT:
|
||||||
bus->flags |= RT_I2C_ADDR_10BIT;
|
bus->flags |= RT_I2C_ADDR_10BIT;
|
||||||
break;
|
break;
|
||||||
case RT_I2C_DEV_CTRL_ADDR:
|
|
||||||
bus->addr = *(rt_uint16_t *)args;
|
|
||||||
break;
|
|
||||||
case RT_I2C_DEV_CTRL_TIMEOUT:
|
case RT_I2C_DEV_CTRL_TIMEOUT:
|
||||||
bus->timeout = *(rt_uint32_t *)args;
|
bus->timeout = *(rt_uint32_t *)args;
|
||||||
break;
|
break;
|
||||||
|
@ -55,7 +55,6 @@ struct rt_i2c_bus_device
|
|||||||
struct rt_device parent;
|
struct rt_device parent;
|
||||||
const struct rt_i2c_bus_device_ops *ops;
|
const struct rt_i2c_bus_device_ops *ops;
|
||||||
rt_uint16_t flags;
|
rt_uint16_t flags;
|
||||||
rt_uint16_t addr;
|
|
||||||
struct rt_mutex lock;
|
struct rt_mutex lock;
|
||||||
rt_uint32_t timeout;
|
rt_uint32_t timeout;
|
||||||
rt_uint32_t retries;
|
rt_uint32_t retries;
|
||||||
@ -64,7 +63,6 @@ struct rt_i2c_bus_device
|
|||||||
|
|
||||||
struct rt_i2c_client
|
struct rt_i2c_client
|
||||||
{
|
{
|
||||||
struct rt_device parent;
|
|
||||||
struct rt_i2c_bus_device *bus;
|
struct rt_i2c_bus_device *bus;
|
||||||
rt_uint16_t client_addr;
|
rt_uint16_t client_addr;
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,6 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RT_I2C_DEV_CTRL_10BIT 0x20
|
#define RT_I2C_DEV_CTRL_10BIT 0x20
|
||||||
#define RT_I2C_DEV_CTRL_ADDR 0x21
|
|
||||||
#define RT_I2C_DEV_CTRL_TIMEOUT 0x22
|
#define RT_I2C_DEV_CTRL_TIMEOUT 0x22
|
||||||
#define RT_I2C_DEV_CTRL_RW 0x23
|
#define RT_I2C_DEV_CTRL_RW 0x23
|
||||||
#define RT_I2C_DEV_CTRL_CLK 0x24
|
#define RT_I2C_DEV_CTRL_CLK 0x24
|
||||||
|
Loading…
x
Reference in New Issue
Block a user