modules/hal_st: Align sensor drivers to stmemsc HAL i/f v2.00
Align all sensor drivers that are using stmemsc (STdC) HAL i/f to new APIs of stmemsc v2.00. Requires https://github.com/zephyrproject-rtos/hal_st/pull/7 (merged as 575de9d461aa6f430cf62c58a053675377e700f3) Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
parent
93587e9178
commit
7f9e3af932
4 changed files with 20 additions and 30 deletions
|
@ -319,16 +319,16 @@ static int lsm6dso_sample_fetch_accel(const struct device *dev)
|
|||
const struct lsm6dso_config *cfg = dev->config;
|
||||
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
|
||||
struct lsm6dso_data *data = dev->data;
|
||||
union axis3bit16_t buf;
|
||||
int16_t buf[3];
|
||||
|
||||
if (lsm6dso_acceleration_raw_get(ctx, buf.u8bit) < 0) {
|
||||
if (lsm6dso_acceleration_raw_get(ctx, buf) < 0) {
|
||||
LOG_DBG("Failed to read sample");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
data->acc[0] = sys_le16_to_cpu(buf.i16bit[0]);
|
||||
data->acc[1] = sys_le16_to_cpu(buf.i16bit[1]);
|
||||
data->acc[2] = sys_le16_to_cpu(buf.i16bit[2]);
|
||||
data->acc[0] = sys_le16_to_cpu(buf[0]);
|
||||
data->acc[1] = sys_le16_to_cpu(buf[1]);
|
||||
data->acc[2] = sys_le16_to_cpu(buf[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -338,16 +338,16 @@ static int lsm6dso_sample_fetch_gyro(const struct device *dev)
|
|||
const struct lsm6dso_config *cfg = dev->config;
|
||||
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
|
||||
struct lsm6dso_data *data = dev->data;
|
||||
union axis3bit16_t buf;
|
||||
int16_t buf[3];
|
||||
|
||||
if (lsm6dso_angular_rate_raw_get(ctx, buf.u8bit) < 0) {
|
||||
if (lsm6dso_angular_rate_raw_get(ctx, buf) < 0) {
|
||||
LOG_DBG("Failed to read sample");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
data->gyro[0] = sys_le16_to_cpu(buf.i16bit[0]);
|
||||
data->gyro[1] = sys_le16_to_cpu(buf.i16bit[1]);
|
||||
data->gyro[2] = sys_le16_to_cpu(buf.i16bit[2]);
|
||||
data->gyro[0] = sys_le16_to_cpu(buf[0]);
|
||||
data->gyro[1] = sys_le16_to_cpu(buf[1]);
|
||||
data->gyro[2] = sys_le16_to_cpu(buf[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -358,14 +358,14 @@ static int lsm6dso_sample_fetch_temp(const struct device *dev)
|
|||
const struct lsm6dso_config *cfg = dev->config;
|
||||
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
|
||||
struct lsm6dso_data *data = dev->data;
|
||||
union axis1bit16_t buf;
|
||||
int16_t buf;
|
||||
|
||||
if (lsm6dso_temperature_raw_get(ctx, buf.u8bit) < 0) {
|
||||
if (lsm6dso_temperature_raw_get(ctx, &buf) < 0) {
|
||||
LOG_DBG("Failed to read sample");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
data->temp_sample = sys_le16_to_cpu(buf.i16bit);
|
||||
data->temp_sample = sys_le16_to_cpu(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,16 +27,6 @@
|
|||
#include <drivers/i2c.h>
|
||||
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */
|
||||
|
||||
union axis3bit16_t {
|
||||
int16_t i16bit[3];
|
||||
uint8_t u8bit[6];
|
||||
};
|
||||
|
||||
union axis1bit16_t {
|
||||
int16_t i16bit;
|
||||
uint8_t u8bit[2];
|
||||
};
|
||||
|
||||
#define LSM6DSO_EN_BIT 0x01
|
||||
#define LSM6DSO_DIS_BIT 0x00
|
||||
|
||||
|
|
|
@ -31,10 +31,10 @@ static int lsm6dso_enable_t_int(const struct device *dev, int enable)
|
|||
lsm6dso_int2_ctrl_t int2_ctrl;
|
||||
|
||||
if (enable) {
|
||||
union axis1bit16_t buf;
|
||||
int16_t buf;
|
||||
|
||||
/* dummy read: re-trigger interrupt */
|
||||
lsm6dso_temperature_raw_get(ctx, buf.u8bit);
|
||||
lsm6dso_temperature_raw_get(ctx, &buf);
|
||||
}
|
||||
|
||||
/* set interrupt (TEMP DRDY interrupt is only on INT2) */
|
||||
|
@ -57,10 +57,10 @@ static int lsm6dso_enable_xl_int(const struct device *dev, int enable)
|
|||
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
|
||||
|
||||
if (enable) {
|
||||
union axis3bit16_t buf;
|
||||
int16_t buf[3];
|
||||
|
||||
/* dummy read: re-trigger interrupt */
|
||||
lsm6dso_acceleration_raw_get(ctx, buf.u8bit);
|
||||
lsm6dso_acceleration_raw_get(ctx, buf);
|
||||
}
|
||||
|
||||
/* set interrupt */
|
||||
|
@ -93,10 +93,10 @@ static int lsm6dso_enable_g_int(const struct device *dev, int enable)
|
|||
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
|
||||
|
||||
if (enable) {
|
||||
union axis3bit16_t buf;
|
||||
int16_t buf[3];
|
||||
|
||||
/* dummy read: re-trigger interrupt */
|
||||
lsm6dso_angular_rate_raw_get(ctx, buf.u8bit);
|
||||
lsm6dso_angular_rate_raw_get(ctx, buf);
|
||||
}
|
||||
|
||||
/* set interrupt */
|
||||
|
|
2
west.yml
2
west.yml
|
@ -69,7 +69,7 @@ manifest:
|
|||
revision: be39d4eebeddac6e18e9c0c3ba1b31ad1e82eaed
|
||||
path: modules/hal/silabs
|
||||
- name: hal_st
|
||||
revision: b52fdbf4b62439be9fab9bb4bae9690a42d2fb14
|
||||
revision: 575de9d461aa6f430cf62c58a053675377e700f3
|
||||
path: modules/hal/st
|
||||
- name: hal_stm32
|
||||
revision: f8ff8d25aa0a9e65948040c7b47ec67f3fa300df
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue