From 6b9bdc12a9d9ca6bd63144194060f116cc42139e Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Fri, 11 Nov 2022 21:29:48 -0500 Subject: [PATCH] [sensor] use arg to replace user_data --- bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c | 4 ++-- components/drivers/include/drivers/sensor.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c index fac1209a63..cc618575b8 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c @@ -19,7 +19,7 @@ int sensor_init(void) cfg.intf.type = RT_SENSOR_INTF_I2C; cfg.intf.dev_name = "i2c3"; - cfg.intf.user_data = (void *)MPU6XXX_ADDR_DEFAULT; + cfg.intf.arg = (void *)MPU6XXX_ADDR_DEFAULT; cfg.irq_pin.pin = RT_PIN_NONE; rt_hw_mpu6xxx_init("icm", &cfg); @@ -40,7 +40,7 @@ int rt_hw_aht10_port(void) struct rt_sensor_config cfg; cfg.intf.dev_name = AHT10_I2C_BUS; - cfg.intf.user_data = (void *)AHT10_I2C_ADDR; + cfg.intf.arg = (void *)AHT10_I2C_ADDR; rt_hw_aht10_init("aht10", &cfg); diff --git a/components/drivers/include/drivers/sensor.h b/components/drivers/include/drivers/sensor.h index 11b4e00c24..a27887298d 100644 --- a/components/drivers/include/drivers/sensor.h +++ b/components/drivers/include/drivers/sensor.h @@ -144,9 +144,9 @@ struct rt_sensor_info struct rt_sensor_intf { - char *dev_name; /* The name of the communication device */ - rt_uint8_t type; /* Communication interface type */ - void *user_data; /* Private data for the sensor. ex. i2c addr,spi cs,control I/O */ + char *dev_name; /* The name of the communication device */ + rt_uint8_t type; /* Communication interface type */ + void *arg; /* Interface argument for the sensor. ex. i2c addr,spi cs,control I/O */ }; struct rt_sensor_config -- GitLab