From 37d8709f3f2805376fd4b4fe8333d403f321d20e Mon Sep 17 00:00:00 2001 From: Kees Bakker <kees@sodaq.com> Date: Sun, 6 Jan 2019 17:08:04 +0100 Subject: [PATCH] drivers/lsm303dlhc: correct cast of phydat_t* The read functions have a lsm303dlhc_3d_data_t* argument which is a struct with 3 int16_t members. Thus we should cast res->val instead of just res. --- drivers/lsm303dlhc/lsm303dlhc_saul.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/lsm303dlhc/lsm303dlhc_saul.c b/drivers/lsm303dlhc/lsm303dlhc_saul.c index c5278d27b7..8b34e423c5 100644 --- a/drivers/lsm303dlhc/lsm303dlhc_saul.c +++ b/drivers/lsm303dlhc/lsm303dlhc_saul.c @@ -26,7 +26,7 @@ static int read_acc(const void *dev, phydat_t *res) { const lsm303dlhc_t *d = (const lsm303dlhc_t *)dev; - lsm303dlhc_read_acc(d, (lsm303dlhc_3d_data_t *)res); + lsm303dlhc_read_acc(d, (lsm303dlhc_3d_data_t *)res->val); /* normalize result */ int fac = (1 << (d->params.acc_scale >> 4)); @@ -43,7 +43,7 @@ static int read_mag(const void *dev, phydat_t *res) { const lsm303dlhc_t *d = (const lsm303dlhc_t *)dev; - lsm303dlhc_read_mag(d, (lsm303dlhc_3d_data_t *)res); + lsm303dlhc_read_mag(d, (lsm303dlhc_3d_data_t *)res->val); /* normalize results */ int gain; -- GitLab