modules/hal_st: Align sensor drivers to stmemsc HAL i/f v1.03

Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v1.03.

Requires https://github.com/zephyrproject-rtos/hal_st/pull/5
(merged as b52fdbf4b62439be9fab9bb4bae9690a42d2fb14)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2020-10-05 18:06:27 +02:00 committed by Maureen Helm
commit de5135b05e
20 changed files with 128 additions and 104 deletions

View file

@ -182,10 +182,10 @@ static int lis2dw12_sample_fetch(const struct device *dev,
struct lis2dw12_data *lis2dw12 = dev->data;
const struct lis2dw12_device_config *cfg = dev->config;
uint8_t shift;
union axis3bit16_t buf;
int16_t buf[3];
/* fetch raw data sample */
if (lis2dw12_acceleration_raw_get(lis2dw12->ctx, buf.u8bit) < 0) {
if (lis2dw12_acceleration_raw_get(lis2dw12->ctx, buf) < 0) {
LOG_DBG("Failed to fetch raw data sample");
return -EIO;
}
@ -197,9 +197,9 @@ static int lis2dw12_sample_fetch(const struct device *dev,
shift = LIS2DW12_SHIFT_PMOTHER;
}
lis2dw12->acc[0] = sys_le16_to_cpu(buf.i16bit[0]) >> shift;
lis2dw12->acc[1] = sys_le16_to_cpu(buf.i16bit[1]) >> shift;
lis2dw12->acc[2] = sys_le16_to_cpu(buf.i16bit[2]) >> shift;
lis2dw12->acc[0] = sys_le16_to_cpu(buf[0]) >> shift;
lis2dw12->acc[1] = sys_le16_to_cpu(buf[1]) >> shift;
lis2dw12->acc[2] = sys_le16_to_cpu(buf[2]) >> shift;
return 0;
}