You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2019/02/12 02:11:38 UTC

[mynewt-core] branch master updated: hw/drivers/lps33thw: small fixes (#1640)

This is an automated email from the ASF dual-hosted git repository.

vipulrahane 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 7248e9f  hw/drivers/lps33thw: small fixes (#1640)
7248e9f is described below

commit 7248e9f7c1d7357fdc9319ee7f444ebe7ab05d5c
Author: kasjer <ka...@users.noreply.github.com>
AuthorDate: Tue Feb 12 03:11:33 2019 +0100

    hw/drivers/lps33thw: small fixes (#1640)
    
    * hw/drivers/lps33thw: Small coding style fixes
    - Missing spaces
    - Code/declaration mix
    - Fix build warning
    - When LPS33THW_ONE_SHOT_MODE was NOT specified variable
    lps33thw was redeclared in a block leaving previous
    declaration unused.
---
 hw/drivers/sensors/lps33thw/src/lps33thw.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/hw/drivers/sensors/lps33thw/src/lps33thw.c b/hw/drivers/sensors/lps33thw/src/lps33thw.c
index eaaa1ee..e800a3a 100644
--- a/hw/drivers/sensors/lps33thw/src/lps33thw.c
+++ b/hw/drivers/sensors/lps33thw/src/lps33thw.c
@@ -109,12 +109,9 @@ static const struct sensor_driver g_lps33thw_sensor_driver = {
 static void lps33thw_one_shot_read_cb(struct os_event *ev)
 {
     int rc;
-    struct lps33thw *lps33thw;
-    struct sensor *sensor;
-    lps33thw = (struct lps33thw *)ev->ev_arg;
-    sensor = &lps33thw->sensor;
-    struct sensor_itf *itf;
-    itf = SENSOR_GET_ITF(sensor);
+    struct lps33thw *lps33thw = (struct lps33thw *)ev->ev_arg;
+    struct sensor *sensor = &lps33thw->sensor;
+    struct sensor_itf *itf = SENSOR_GET_ITF(sensor);
 
     if (lps33thw->type & SENSOR_TYPE_PRESSURE) {
         if (lps33thw->cfg.int_cfg.data_rdy) {
@@ -136,7 +133,7 @@ static void lps33thw_one_shot_read_cb(struct os_event *ev)
         struct sensor_temp_data std;
 
         rc = lps33thw_get_temperature(itf, &std.std_temp);
-        if(!rc){
+        if (!rc) {
             std.std_temp_is_valid = 1;
             rc = lps33thw->data_func(sensor, &lps33thw->pdd.user_ctx, &std,
                     SENSOR_TYPE_TEMPERATURE);
@@ -1085,15 +1082,15 @@ lps33thw_sensor_read(struct sensor *sensor, sensor_type_t type,
         sensor_data_func_t data_func, void *data_arg, uint32_t timeout)
 {
     int rc = SYS_EINVAL;
-    struct sensor_itf *itf;
-    itf = SENSOR_GET_ITF(sensor);
+    struct sensor_itf *itf = SENSOR_GET_ITF(sensor);
     uint8_t rate;
+    struct lps33thw *lps33thw  = (struct lps33thw *)SENSOR_GET_DEVICE(sensor);
+
     rc = lps33thw_get_value(itf, LPS33THW_CTRL_REG1_ODR, &rate);
     if (rc) {
         return rc;
     }
-    struct lps33thw *lps33thw;
-    lps33thw = (struct lps33thw *)SENSOR_GET_DEVICE(sensor);
+
     (void)timeout;
 
 #if MYNEWT_VAL(LPS33THW_ONE_SHOT_MODE)
@@ -1115,8 +1112,6 @@ lps33thw_sensor_read(struct sensor *sensor, sensor_type_t type,
 #endif
 
     if (type & SENSOR_TYPE_PRESSURE) {
-        struct lps33thw *lps33thw;
-        lps33thw = (struct lps33thw *)SENSOR_GET_DEVICE(sensor);
         if (lps33thw->cfg.int_cfg.data_rdy) {
             /* Stream read */
             lps33thw->pdd.user_ctx.user_func = data_func;