drivers/mpu9150: correct cast of phydat_t*

The read functions have a mpu9150_results_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 18:14:53 +01:00
parent cf560eaca7
commit 1e4b956eeb

View File

@ -25,7 +25,7 @@
static int read_acc(const void *dev, phydat_t *res) static int read_acc(const void *dev, phydat_t *res)
{ {
int ret = mpu9150_read_accel((const mpu9150_t *)dev, (mpu9150_results_t *)res); int ret = mpu9150_read_accel((const mpu9150_t *)dev, (mpu9150_results_t *)res->val);
if (ret < 0) { if (ret < 0) {
return -ECANCELED; return -ECANCELED;
} }
@ -38,7 +38,7 @@ static int read_acc(const void *dev, phydat_t *res)
static int read_gyro(const void *dev, phydat_t *res) static int read_gyro(const void *dev, phydat_t *res)
{ {
int ret = mpu9150_read_gyro((const mpu9150_t *)dev, (mpu9150_results_t *)res); int ret = mpu9150_read_gyro((const mpu9150_t *)dev, (mpu9150_results_t *)res->val);
if (ret < 0) { if (ret < 0) {
return -ECANCELED; return -ECANCELED;
} }
@ -51,7 +51,7 @@ static int read_gyro(const void *dev, phydat_t *res)
static int read_mag(const void *dev, phydat_t *res) static int read_mag(const void *dev, phydat_t *res)
{ {
int ret = mpu9150_read_compass((const mpu9150_t *)dev, (mpu9150_results_t *)res); int ret = mpu9150_read_compass((const mpu9150_t *)dev, (mpu9150_results_t *)res->val);
if (ret < 0) { if (ret < 0) {
return -ECANCELED; return -ECANCELED;
} }