1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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.
This commit is contained in:
Kees Bakker 2019-01-06 17:08:04 +01:00
parent b77c802f9b
commit 37d8709f3f

View File

@ -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;