summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorsp-cai <[email protected]>2023-07-14 09:57:40 +0800
committerGitHub <[email protected]>2023-07-13 21:57:40 -0400
commit0ebec472e16cc88d5ed5453d99059af0031998d1 (patch)
treeac7869e2d5ed60465836a88c92bb6769df7a19f5 /components/drivers/include
parent350626841a3baea98e0bb8737d844dbd814a50c1 (diff)
[components][i2c] 优化 controt 接口格式,增加可用命令 (#7806)
原来 rt_i2c_control 只能执行 RT_I2C_DEV_CTRL_CLK 单一命令,通过此修改可以支持更多可用命令
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/i2c.h8
-rw-r--r--components/drivers/include/drivers/i2c_dev.h4
2 files changed, 8 insertions, 4 deletions
diff --git a/components/drivers/include/drivers/i2c.h b/components/drivers/include/drivers/i2c.h
index 2a900536df..ed87425260 100644
--- a/components/drivers/include/drivers/i2c.h
+++ b/components/drivers/include/drivers/i2c.h
@@ -45,8 +45,8 @@ struct rt_i2c_bus_device_ops
struct rt_i2c_msg msgs[],
rt_uint32_t num);
rt_err_t (*i2c_bus_control)(struct rt_i2c_bus_device *bus,
- rt_uint32_t,
- rt_uint32_t);
+ int cmd,
+ void *args);
};
/*for i2c bus driver*/
@@ -74,8 +74,8 @@ rt_ssize_t rt_i2c_transfer(struct rt_i2c_bus_device *bus,
struct rt_i2c_msg msgs[],
rt_uint32_t num);
rt_err_t rt_i2c_control(struct rt_i2c_bus_device *bus,
- rt_uint32_t cmd,
- rt_uint32_t arg);
+ int cmd,
+ void *args);
rt_ssize_t rt_i2c_master_send(struct rt_i2c_bus_device *bus,
rt_uint16_t addr,
rt_uint16_t flags,
diff --git a/components/drivers/include/drivers/i2c_dev.h b/components/drivers/include/drivers/i2c_dev.h
index 60bbad0507..6744fa142d 100644
--- a/components/drivers/include/drivers/i2c_dev.h
+++ b/components/drivers/include/drivers/i2c_dev.h
@@ -23,6 +23,10 @@ extern "C" {
#define RT_I2C_DEV_CTRL_TIMEOUT (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x03)
#define RT_I2C_DEV_CTRL_RW (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x04)
#define RT_I2C_DEV_CTRL_CLK (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x05)
+#define RT_I2C_DEV_CTRL_UNLOCK (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x06)
+#define RT_I2C_DEV_CTRL_GET_STATE (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x07)
+#define RT_I2C_DEV_CTRL_GET_MODE (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x08)
+#define RT_I2C_DEV_CTRL_GET_ERROR (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x09)
struct rt_i2c_priv_data
{