You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/06/16 00:01:24 UTC

[incubator-nuttx] branch master updated (7ce175b -> 53387b5)

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

aguettouche pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 7ce175b  style fixes
     new 6c333d7  bmp280: support getting temperature via ioctl()
     new 53387b5  style fixes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 drivers/sensors/bmp280.c       | 33 ++++++++++++++++++++++++++++++++-
 include/nuttx/sensors/bmp280.h | 11 +++++++++++
 2 files changed, 43 insertions(+), 1 deletion(-)


[incubator-nuttx] 02/02: style fixes

Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 53387b53c6fd4da860cb15b83569b2b8579dd515
Author: Matias Nitsche <mn...@dc.uba.ar>
AuthorDate: Mon Jun 15 18:45:34 2020 -0300

    style fixes
---
 drivers/sensors/bmp280.c       | 11 ++++++-----
 include/nuttx/sensors/bmp280.h |  4 ++++
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/sensors/bmp280.c b/drivers/sensors/bmp280.c
index fb0ea49..beca4f6 100644
--- a/drivers/sensors/bmp280.c
+++ b/drivers/sensors/bmp280.c
@@ -163,7 +163,8 @@ struct bmp280_dev_s
  * Private Function Prototypes
  ****************************************************************************/
 
-static uint8_t bmp280_getreg8(FAR struct bmp280_dev_s *priv, uint8_t regaddr);
+static uint8_t bmp280_getreg8(FAR struct bmp280_dev_s *priv,
+                              uint8_t regaddr);
 static void bmp280_putreg8(FAR struct bmp280_dev_s *priv, uint8_t regaddr,
                            uint8_t regval);
 static uint32_t bmp280_getpressure(FAR struct bmp280_dev_s *priv);
@@ -568,9 +569,9 @@ static uint32_t bmp280_gettemp(FAR struct bmp280_dev_s *priv)
   sninfo("temp = %d\n", temp);
 
   if (priv->compensated == ENABLE_COMPENSATED)
-  {
-    temp = bmp280_compensate_temp(priv, temp);
-  }
+    {
+      temp = bmp280_compensate_temp(priv, temp);
+    }
 
   return temp;
 }
@@ -669,7 +670,7 @@ static int bmp280_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
         break;
 
       case SNIOC_GET_TEMP:
-        *(uint32_t*)arg = bmp280_gettemp(priv);
+        *(uint32_t *)arg = bmp280_gettemp(priv);
 
       default:
         snerr("Unrecognized cmd: %d\n", cmd);
diff --git a/include/nuttx/sensors/bmp280.h b/include/nuttx/sensors/bmp280.h
index 7c74987..2d23020 100644
--- a/include/nuttx/sensors/bmp280.h
+++ b/include/nuttx/sensors/bmp280.h
@@ -36,6 +36,10 @@
 #ifndef __INCLUDE_NUTTX_SENSORS_BMP280_H
 #define __INCLUDE_NUTTX_SENSORS_BMP280_H
 
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
 #include <nuttx/config.h>
 
 #if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_BMP280) || defined(CONFIG_SENSORS_BMP280_SCU))


[incubator-nuttx] 01/02: bmp280: support getting temperature via ioctl()

Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 6c333d7cbfaf834b8fb45468f64384db00c57e54
Author: Matias Nitsche <mn...@dc.uba.ar>
AuthorDate: Mon Jun 15 12:29:52 2020 -0300

    bmp280: support getting temperature via ioctl()
---
 drivers/sensors/bmp280.c       | 30 ++++++++++++++++++++++++++++++
 include/nuttx/sensors/bmp280.h |  7 +++++++
 2 files changed, 37 insertions(+)

diff --git a/drivers/sensors/bmp280.c b/drivers/sensors/bmp280.c
index ff557cc..fb0ea49 100644
--- a/drivers/sensors/bmp280.c
+++ b/drivers/sensors/bmp280.c
@@ -549,6 +549,33 @@ static uint32_t bmp280_getpressure(FAR struct bmp280_dev_s *priv)
 }
 
 /****************************************************************************
+ * Name: bmp280_gettemp
+ *
+ * Description:
+ *   Read temperature only
+ *
+ ****************************************************************************/
+
+static uint32_t bmp280_gettemp(FAR struct bmp280_dev_s *priv)
+{
+  uint8_t buf[3];
+  int32_t temp;
+
+  bmp280_getregs(priv, BMP280_TEMP_MSB, buf, 3);
+
+  temp = COMBINE(buf);
+
+  sninfo("temp = %d\n", temp);
+
+  if (priv->compensated == ENABLE_COMPENSATED)
+  {
+    temp = bmp280_compensate_temp(priv, temp);
+  }
+
+  return temp;
+}
+
+/****************************************************************************
  * Name: bmp280_open
  *
  * Description:
@@ -641,6 +668,9 @@ static int bmp280_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
         ret = bmp280_set_standby(priv, arg);
         break;
 
+      case SNIOC_GET_TEMP:
+        *(uint32_t*)arg = bmp280_gettemp(priv);
+
       default:
         snerr("Unrecognized cmd: %d\n", cmd);
         ret = - ENOTTY;
diff --git a/include/nuttx/sensors/bmp280.h b/include/nuttx/sensors/bmp280.h
index 44da043..7c74987 100644
--- a/include/nuttx/sensors/bmp280.h
+++ b/include/nuttx/sensors/bmp280.h
@@ -112,6 +112,13 @@ extern "C"
 
 #define SNIOC_SETSTB               _SNIOC(0x0003)
 
+/* Get temperature value
+ *
+ * Arg: Pointer to uint32_t (raw value)
+ */
+
+#define SNIOC_GET_TEMP             _SNIOC(0x0004)
+
 struct bmp280_press_adj_s
 {
   uint16_t  dig_p1; /* calibration P1 data */