]> git.itanic.dy.fi Git - BME280_driver/commitdiff
Changed
authorBosch Sensortec <github@bosch-sensortec.com>
Wed, 8 Nov 2017 06:47:27 +0000 (07:47 +0100)
committerBosch Sensortec <github@bosch-sensortec.com>
Wed, 8 Nov 2017 06:48:36 +0000 (07:48 +0100)
 - Created the following user APIs which were previously static
  * bme280_parse_sensor_data
  * bme280_compensate_data

README.md
bme280.c
bme280.h
bme280_defs.h
changelog.md

index 9da74b10f114eaae8df6b8c06612a19ef1e3a8f6..df453d2848645d0b119d18dfbb3b87dc10a19180 100644 (file)
--- a/README.md
+++ b/README.md
@@ -5,11 +5,11 @@ This package contains the Bosch Sensortec's BME280 pressure sensor driver (senso
 The sensor driver package includes bme280.c, bme280.h and bme280_defs.h files.
 
 ## Version
-File | Version | Date
------|---------|-----
-bme280.c |  3.3.0     | 13 Jul 2017
-bme280.h |  3.3.0     | 13 Jul 2017
-bme280_defs.h |  3.3.0     | 13 Jul 2017
+File          | Version | Date
+--------------|---------|------------
+bme280.c      |  3.3.1  | 07 Nov 2017
+bme280.h      |  3.3.1  | 07 Nov 2017
+bme280_defs.h |  3.3.1  | 07 Nov 2017
 
 ## Integration details
 * Integrate bme280.h, bme280_defs.h and bme280.c file in to the project.
index 762549600e2a4ace6496ecc2ed3a2e9d5b46da8d..e4b6cbba0140a70cf711f09cf3e9594f70d0ed84 100644 (file)
--- a/bme280.c
+++ b/bme280.c
@@ -40,8 +40,8 @@
  * patent rights of the copyright holder.
  *
  * File                bme280.c
- * Date                13 Jul 2017
- * Version     3.3.0
+ * Date                07 Nov 2017
+ * Version     3.3.1
  *
  */
 
@@ -129,35 +129,6 @@ static void parse_temp_press_calib_data(const uint8_t *reg_data, struct bme280_d
  */
 static void parse_humidity_calib_data(const uint8_t *reg_data, struct bme280_dev *dev);
 
-/*!
- *  @brief This internal API is used to parse the pressure, temperature and
- *  humidity data and store it in the bme280_uncomp_data structure instance.
- *
- *  @param[in] reg_data : Contains the register data which needs to be parsed.
- *  @param[out] uncomp_data : Contains the uncompensated pressure, temperature
- *  and humidity data.
- */
-static void parse_sensor_data(const uint8_t *reg_data, struct bme280_uncomp_data *uncomp_data);
-
-/*!
- * @brief This internal API is used to compensate the pressure and/or
- * temperature and/or humidity data according to the component selected by the
- * user.
- *
- * @param[in] sensor_comp : Used to select pressure and/or temperature and/or
- * humidity.
- * @param[in] uncomp_data : Contains the uncompensated pressure, temperature and
- * humidity data.
- * @param[out] comp_data : Contains the compensated pressure and/or temperature
- * and/or humidity data.
- * @param[in] calib_data : Pointer to the calibration data structure.
- *
- * @return Result of API execution status.
- * @retval zero -> Success / -ve value -> Error
- */
-static int8_t compensate_data(uint8_t sensor_comp, const struct bme280_uncomp_data *uncomp_data,
-                                    struct bme280_data *comp_data, struct bme280_calib_data *calib_data);
-
 #ifdef BME280_FLOAT_ENABLE
 /*!
  * @brief This internal API is used to compensate the raw pressure data and
@@ -446,7 +417,8 @@ int8_t bme280_set_regs(uint8_t *reg_addr, const uint8_t *reg_data, uint8_t len,
 {
        int8_t rslt;
        uint8_t temp_buff[20]; /* Typically not to write more than 10 registers */
-       if(len > 10)
+
+       if (len > 10)
                len = 10;
 
        uint16_t temp_len;
@@ -629,10 +601,75 @@ int8_t bme280_get_sensor_data(uint8_t sensor_comp, struct bme280_data *comp_data
 
                if (rslt == BME280_OK) {
                        /* Parse the read data from the sensor */
-                       parse_sensor_data(reg_data, &uncomp_data);
+                       bme280_parse_sensor_data(reg_data, &uncomp_data);
                        /* Compensate the pressure and/or temperature and/or
                           humidity data from the sensor */
-                       rslt = compensate_data(sensor_comp, &uncomp_data, comp_data, &dev->calib_data);
+                       rslt = bme280_compensate_data(sensor_comp, &uncomp_data, comp_data, &dev->calib_data);
+               }
+       } else {
+               rslt = BME280_E_NULL_PTR;
+       }
+
+       return rslt;
+}
+
+/*!
+ *  @brief This API is used to parse the pressure, temperature and
+ *  humidity data and store it in the bme280_uncomp_data structure instance.
+ */
+void bme280_parse_sensor_data(const uint8_t *reg_data, struct bme280_uncomp_data *uncomp_data)
+{
+       /* Variables to store the sensor data */
+       uint32_t data_xlsb;
+       uint32_t data_lsb;
+       uint32_t data_msb;
+
+       /* Store the parsed register values for pressure data */
+       data_msb = (uint32_t)reg_data[0] << 12;
+       data_lsb = (uint32_t)reg_data[1] << 4;
+       data_xlsb = (uint32_t)reg_data[2] >> 4;
+       uncomp_data->pressure = data_msb | data_lsb | data_xlsb;
+
+       /* Store the parsed register values for temperature data */
+       data_msb = (uint32_t)reg_data[3] << 12;
+       data_lsb = (uint32_t)reg_data[4] << 4;
+       data_xlsb = (uint32_t)reg_data[5] >> 4;
+       uncomp_data->temperature = data_msb | data_lsb | data_xlsb;
+
+       /* Store the parsed register values for temperature data */
+       data_lsb = (uint32_t)reg_data[6] << 8;
+       data_msb = (uint32_t)reg_data[7];
+       uncomp_data->humidity = data_msb | data_lsb;
+}
+
+
+/*!
+ * @brief This API is used to compensate the pressure and/or
+ * temperature and/or humidity data according to the component selected
+ * by the user.
+ */
+int8_t bme280_compensate_data(uint8_t sensor_comp, const struct bme280_uncomp_data *uncomp_data,
+                                    struct bme280_data *comp_data, struct bme280_calib_data *calib_data)
+{
+       int8_t rslt = BME280_OK;
+
+       if ((uncomp_data != NULL) && (comp_data != NULL) && (calib_data != NULL)) {
+               /* Initialize to zero */
+               comp_data->temperature = 0;
+               comp_data->pressure = 0;
+               comp_data->humidity = 0;
+               /* If pressure or temperature component is selected */
+               if (sensor_comp & (BME280_PRESS | BME280_TEMP | BME280_HUM)) {
+                       /* Compensate the temperature data */
+                       comp_data->temperature = compensate_temperature(uncomp_data, calib_data);
+               }
+               if (sensor_comp & BME280_PRESS) {
+                       /* Compensate the pressure data */
+                       comp_data->pressure = compensate_pressure(uncomp_data, calib_data);
+               }
+               if (sensor_comp & BME280_HUM) {
+                       /* Compensate the humidity data */
+                       comp_data->humidity = compensate_humidity(uncomp_data, calib_data);
                }
        } else {
                rslt = BME280_E_NULL_PTR;
@@ -839,70 +876,6 @@ static int8_t reload_device_settings(const struct bme280_settings *settings, con
        return rslt;
 }
 
-/*!
- *  @brief This internal API is used to parse the pressure, temperature and
- *  humidity data and store it in the bme280_uncomp_data structure instance.
- */
-static void parse_sensor_data(const uint8_t *reg_data, struct bme280_uncomp_data *uncomp_data)
-{
-       /* Variables to store the sensor data */
-       uint32_t data_xlsb;
-       uint32_t data_lsb;
-       uint32_t data_msb;
-
-       /* Store the parsed register values for pressure data */
-       data_msb = (uint32_t)reg_data[0] << 12;
-       data_lsb = (uint32_t)reg_data[1] << 4;
-       data_xlsb = (uint32_t)reg_data[2] >> 4;
-       uncomp_data->pressure = data_msb | data_lsb | data_xlsb;
-
-       /* Store the parsed register values for temperature data */
-       data_msb = (uint32_t)reg_data[3] << 12;
-       data_lsb = (uint32_t)reg_data[4] << 4;
-       data_xlsb = (uint32_t)reg_data[5] >> 4;
-       uncomp_data->temperature = data_msb | data_lsb | data_xlsb;
-
-       /* Store the parsed register values for temperature data */
-       data_lsb = (uint32_t)reg_data[6] << 8;
-       data_msb = (uint32_t)reg_data[7];
-       uncomp_data->humidity = data_msb | data_lsb;
-}
-
-/*!
- * @brief This internal API is used to compensate the pressure and/or
- * temperature and/or humidity data according to the component selected
- * by the user.
- */
-static int8_t compensate_data(uint8_t sensor_comp, const struct bme280_uncomp_data *uncomp_data,
-                                    struct bme280_data *comp_data, struct bme280_calib_data *calib_data)
-{
-       int8_t rslt = BME280_OK;
-
-       if ((uncomp_data != NULL) && (comp_data != NULL) && (calib_data != NULL)) {
-               /* Initialize to zero */
-               comp_data->temperature = 0;
-               comp_data->pressure = 0;
-               comp_data->humidity = 0;
-               /* If pressure or temperature component is selected */
-               if (sensor_comp & (BME280_PRESS | BME280_TEMP | BME280_HUM)) {
-                       /* Compensate the temperature data */
-                       comp_data->temperature = compensate_temperature(uncomp_data, calib_data);
-               }
-               if (sensor_comp & BME280_PRESS) {
-                       /* Compensate the pressure data */
-                       comp_data->pressure = compensate_pressure(uncomp_data, calib_data);
-               }
-               if (sensor_comp & BME280_HUM) {
-                       /* Compensate the humidity data */
-                       comp_data->humidity = compensate_humidity(uncomp_data, calib_data);
-               }
-       } else {
-               rslt = BME280_E_NULL_PTR;
-       }
-
-       return rslt;
-}
-
 #ifdef BME280_FLOAT_ENABLE
 /*!
  * @brief This internal API is used to compensate the raw temperature data and
index 4c123ad672ea9efdfd3d89828dd241c4d089032f..77008b33f035d2d255bc9d7a878207f5c01af150 100644 (file)
--- a/bme280.h
+++ b/bme280.h
@@ -40,8 +40,8 @@
  * patent rights of the copyright holder.
  *
  * @file       bme280.h
- * @date       13 Jul 2017
- * @version    3.3.0
+ * @date       07 Nov 2017
+ * @version    3.3.1
  * @brief
  *
  */
@@ -204,6 +204,35 @@ int8_t bme280_soft_reset(const struct bme280_dev *dev);
  */
 int8_t bme280_get_sensor_data(uint8_t sensor_comp, struct bme280_data *comp_data, struct bme280_dev *dev);
 
+/*!
+ *  @brief This API is used to parse the pressure, temperature and
+ *  humidity data and store it in the bme280_uncomp_data structure instance.
+ *
+ *  @param[in] reg_data     : Contains register data which needs to be parsed
+ *  @param[out] uncomp_data : Contains the uncompensated pressure, temperature
+ *  and humidity data.
+ */
+void bme280_parse_sensor_data(const uint8_t *reg_data, struct bme280_uncomp_data *uncomp_data);
+
+/*!
+ * @brief This API is used to compensate the pressure and/or
+ * temperature and/or humidity data according to the component selected by the
+ * user.
+ *
+ * @param[in] sensor_comp : Used to select pressure and/or temperature and/or
+ * humidity.
+ * @param[in] uncomp_data : Contains the uncompensated pressure, temperature and
+ * humidity data.
+ * @param[out] comp_data : Contains the compensated pressure and/or temperature
+ * and/or humidity data.
+ * @param[in] calib_data : Pointer to the calibration data structure.
+ *
+ * @return Result of API execution status.
+ * @retval zero -> Success / -ve value -> Error
+ */
+int8_t bme280_compensate_data(uint8_t sensor_comp, const struct bme280_uncomp_data *uncomp_data,
+                                    struct bme280_data *comp_data, struct bme280_calib_data *calib_data);
+
 #ifdef __cplusplus
 }
 #endif /* End of CPP guard */
index 2398b2caf9deb1308ba30b63f60f6ae8b02bb088..4e35d16587a7ab22d59d8fd9f037cf888d619ad3 100644 (file)
@@ -40,8 +40,8 @@
  * patent rights of the copyright holder.
  *
  * @file       bme280_defs.h
- * @date       13 Jul 2017
- * @version    3.3.0
+ * @date       07 Nov 2017
+ * @version    3.3.1
  * @brief
  *
  */
 #endif
 
 #ifndef BME280_FLOAT_ENABLE
-//#define BME280_FLOAT_ENABLE
+/* #define BME280_FLOAT_ENABLE */
 #endif
 
 #ifndef BME280_FLOAT_ENABLE
-#      ifndef BME280_64BIT_ENABLE
-#              define BME280_64BIT_ENABLE
-#      endif
+#ifndef BME280_64BIT_ENABLE
+#define BME280_64BIT_ENABLE
+#endif
 #endif
 
 #ifndef TRUE
index a30b796e45d3635c60950c3a37b3ed249b4cf56e..98d167180669c0c0e2c66e407126c8909b2c17ed 100644 (file)
@@ -1,6 +1,12 @@
 # Change Log
 All notable changes to BME280 Sensor API will be documented in this file.
 
+## v3.3.1, 07 Nov 2017
+### Changed
+       - Created the following user APIs which were previously static
+          * bme280_parse_sensor_data
+          * bme280_compensate_data
+
 ## v3.3.0, 13 Jul 2017
 ### Changed
        - Changed macro FLOATING_POINT_REPRESENTATION to BME280_FLOAT_ENABLE