You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ml...@apache.org on 2019/09/24 22:05:05 UTC
[mynewt-core] branch master updated: Fixing lps33thw packed struct
pointer warning
This is an automated email from the ASF dual-hosted git repository.
mlaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new e098b15 Fixing lps33thw packed struct pointer warning
new dfba6aa Merge pull request #2008 from mlaz/gcc-9-fixes
e098b15 is described below
commit e098b1575741658bbb700bd5ca2420b899e9f648
Author: Miguel Azevedo <mi...@gmail.com>
AuthorDate: Tue Sep 24 21:49:41 2019 +0100
Fixing lps33thw packed struct pointer warning
---
hw/drivers/sensors/lps33thw/src/lps33thw.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/hw/drivers/sensors/lps33thw/src/lps33thw.c b/hw/drivers/sensors/lps33thw/src/lps33thw.c
index 816c0a7..fd5e144 100644
--- a/hw/drivers/sensors/lps33thw/src/lps33thw.c
+++ b/hw/drivers/sensors/lps33thw/src/lps33thw.c
@@ -119,9 +119,10 @@ static void lps33thw_one_shot_read_cb(struct os_event *ev)
} else {
/* Read once */
struct sensor_press_data spd;
-
- rc = lps33thw_get_pressure(itf, &spd.spd_press);
+ float press;
+ rc = lps33thw_get_pressure(itf, &press);
if (!rc) {
+ spd.spd_press = press;
spd.spd_press_is_valid = 1;
rc = lps33thw->data_func(sensor, &lps33thw->pdd.user_ctx, &spd, SENSOR_TYPE_PRESSURE);
}
@@ -129,9 +130,10 @@ static void lps33thw_one_shot_read_cb(struct os_event *ev)
}
if (lps33thw->type & SENSOR_TYPE_TEMPERATURE) {
struct sensor_temp_data std;
-
- rc = lps33thw_get_temperature(itf, &std.std_temp);
+ float temp;
+ rc = lps33thw_get_temperature(itf, &temp);
if (!rc) {
+ std.std_temp = temp;
std.std_temp_is_valid = 1;
rc = lps33thw->data_func(sensor, &lps33thw->pdd.user_ctx, &std,
SENSOR_TYPE_TEMPERATURE);
@@ -1092,16 +1094,18 @@ lps33thw_read_interrupt_handler(void *arg)
struct lps33thw *lps33thw;
struct sensor_itf *itf;
struct sensor_press_data spd;
+ float press;
sensor = (struct sensor *)arg;
lps33thw = (struct lps33thw *)SENSOR_GET_DEVICE(sensor);
itf = SENSOR_GET_ITF(sensor);
- rc = lps33thw_get_pressure(itf, &spd.spd_press);
+ rc = lps33thw_get_pressure(itf, &press);
if (rc) {
LPS33THW_LOG_ERROR("Get pressure failed\n");
spd.spd_press_is_valid = 0;
} else {
+ spd.spd_press = press;
spd.spd_press_is_valid = 1;
lps33thw->pdd.user_ctx.user_func(sensor, lps33thw->pdd.user_ctx.user_arg,
&spd, SENSOR_TYPE_PRESSURE);
@@ -1153,11 +1157,12 @@ lps33thw_sensor_read_poll(struct sensor *sensor, sensor_type_t type,
} else {
/* Read once */
struct sensor_press_data spd;
- rc = lps33thw_get_pressure(itf, &spd.spd_press);
+ float press;
+ rc = lps33thw_get_pressure(itf, &press);
if (rc) {
return rc;
}
-
+ spd.spd_press = press;
spd.spd_press_is_valid = 1;
rc = data_func(sensor, data_arg, &spd, SENSOR_TYPE_PRESSURE);
@@ -1165,11 +1170,12 @@ lps33thw_sensor_read_poll(struct sensor *sensor, sensor_type_t type,
}
if (type & SENSOR_TYPE_TEMPERATURE) {
struct sensor_temp_data std;
-
- rc = lps33thw_get_temperature(itf, &std.std_temp);
+ float temp;
+ rc = lps33thw_get_temperature(itf, &temp);
if (rc) {
return rc;
}
+ std.std_temp = temp;
std.std_temp_is_valid = 1;
rc = data_func(sensor, data_arg, &std,