Manuel Caballero / BME280
Revision:
3:ab857b70346e
Parent:
2:853301624d95
--- a/BME280.cpp	Tue Sep 03 15:15:15 2019 +0000
+++ b/BME280.cpp	Tue Sep 03 15:36:35 2019 +0000
@@ -84,296 +84,7 @@
 /* To identify filter and standby settings selected by user */
 #define FILTER_STANDBY_SETTINGS UINT8_C(0x18)
 
-/*!
- * @brief This internal API puts the device to sleep mode.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- *
- * @return Result of API execution status.
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
- */
-static int8_t put_device_to_sleep(const struct bme280_dev *dev);
 
-/*!
- * @brief This internal API writes the power mode in the sensor.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- * @param[in] sensor_mode : Variable which contains the power mode to be set.
- *
- * @return Result of API execution status.
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
- */
-static int8_t write_power_mode(uint8_t sensor_mode, const struct bme280_dev *dev);
-
-/*!
- * @brief This internal API is used to validate the device pointer for
- * null conditions.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- *
- * @return Result of API execution status
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
- */
-static int8_t null_ptr_check(const struct bme280_dev *dev);
-
-/*!
- * @brief This internal API interleaves the register address between the
- * register data buffer for burst write operation.
- *
- * @param[in] reg_addr : Contains the register address array.
- * @param[out] temp_buff : Contains the temporary buffer to store the
- * register data and register address.
- * @param[in] reg_data : Contains the register data to be written in the
- * temporary buffer.
- * @param[in] len : No of bytes of data to be written for burst write.
- */
-static void interleave_reg_addr(const uint8_t *reg_addr, uint8_t *temp_buff, const uint8_t *reg_data, uint8_t len);
-
-/*!
- * @brief This internal API reads the calibration data from the sensor, parse
- * it and store in the device structure.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- *
- * @return Result of API execution status
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
- */
-static int8_t get_calib_data(struct bme280_dev *dev);
-
-/*!
- *  @brief This internal API is used to parse the temperature and
- *  pressure calibration data and store it in the device structure.
- *
- *  @param[out] dev : Structure instance of bme280_dev to store the calib data.
- *  @param[in] reg_data : Contains the calibration data to be parsed.
- */
-static void parse_temp_press_calib_data(const uint8_t *reg_data, struct bme280_dev *dev);
-
-/*!
- *  @brief This internal API is used to parse the humidity calibration data
- *  and store it in device structure.
- *
- *  @param[out] dev : Structure instance of bme280_dev to store the calib data.
- *  @param[in] reg_data : Contains calibration data to be parsed.
- */
-static void parse_humidity_calib_data(const uint8_t *reg_data, struct bme280_dev *dev);
-
-#ifdef BME280_FLOAT_ENABLE
-
-/*!
- * @brief This internal API is used to compensate the raw pressure data and
- * return the compensated pressure data in double data type.
- *
- * @param[in] uncomp_data : Contains the uncompensated pressure data.
- * @param[in] calib_data : Pointer to the calibration data structure.
- *
- * @return Compensated pressure data.
- * @retval Compensated pressure data in double.
- */
-static double compensate_pressure(const struct bme280_uncomp_data *uncomp_data,
-                                  const struct bme280_calib_data *calib_data);
-
-/*!
- * @brief This internal API is used to compensate the raw humidity data and
- * return the compensated humidity data in double data type.
- *
- * @param[in] uncomp_data : Contains the uncompensated humidity data.
- * @param[in] calib_data : Pointer to the calibration data structure.
- *
- * @return Compensated humidity data.
- * @retval Compensated humidity data in double.
- */
-static double compensate_humidity(const struct bme280_uncomp_data *uncomp_data,
-                                  const struct bme280_calib_data *calib_data);
-
-/*!
- * @brief This internal API is used to compensate the raw temperature data and
- * return the compensated temperature data in double data type.
- *
- * @param[in] uncomp_data : Contains the uncompensated temperature data.
- * @param[in] calib_data : Pointer to calibration data structure.
- *
- * @return Compensated temperature data.
- * @retval Compensated temperature data in double.
- */
-static double compensate_temperature(const struct bme280_uncomp_data *uncomp_data,
-                                     struct bme280_calib_data *calib_data);
-
-#else
-
-/*!
- * @brief This internal API is used to compensate the raw temperature data and
- * return the compensated temperature data in integer data type.
- *
- * @param[in] uncomp_data : Contains the uncompensated temperature data.
- * @param[in] calib_data : Pointer to calibration data structure.
- *
- * @return Compensated temperature data.
- * @retval Compensated temperature data in integer.
- */
-static int32_t compensate_temperature(const struct bme280_uncomp_data *uncomp_data,
-                                      struct bme280_calib_data *calib_data);
-
-/*!
- * @brief This internal API is used to compensate the raw pressure data and
- * return the compensated pressure data in integer data type.
- *
- * @param[in] uncomp_data : Contains the uncompensated pressure data.
- * @param[in] calib_data : Pointer to the calibration data structure.
- *
- * @return Compensated pressure data.
- * @retval Compensated pressure data in integer.
- */
-static uint32_t compensate_pressure(const struct bme280_uncomp_data *uncomp_data,
-                                    const struct bme280_calib_data *calib_data);
-
-/*!
- * @brief This internal API is used to compensate the raw humidity data and
- * return the compensated humidity data in integer data type.
- *
- * @param[in] uncomp_data : Contains the uncompensated humidity data.
- * @param[in] calib_data : Pointer to the calibration data structure.
- *
- * @return Compensated humidity data.
- * @retval Compensated humidity data in integer.
- */
-static uint32_t compensate_humidity(const struct bme280_uncomp_data *uncomp_data,
-                                    const struct bme280_calib_data *calib_data);
-
-#endif
-
-/*!
- * @brief This internal API is used to identify the settings which the user
- * wants to modify in the sensor.
- *
- * @param[in] sub_settings : Contains the settings subset to identify particular
- * group of settings which the user is interested to change.
- * @param[in] desired_settings : Contains the user specified settings.
- *
- * @return Indicates whether user is interested to modify the settings which
- * are related to sub_settings.
- * @retval True -> User wants to modify this group of settings
- * @retval False -> User does not want to modify this group of settings
- */
-static uint8_t are_settings_changed(uint8_t sub_settings, uint8_t desired_settings);
-
-/*!
- * @brief This API sets the humidity oversampling settings of the sensor.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- *
- * @return Result of API execution status
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
- */
-static int8_t set_osr_humidity_settings(const struct bme280_settings *settings, const struct bme280_dev *dev);
-
-/*!
- * @brief This internal API sets the oversampling settings for pressure,
- * temperature and humidity in the sensor.
- *
- * @param[in] desired_settings : Variable used to select the settings which
- * are to be set.
- * @param[in] dev : Structure instance of bme280_dev.
- *
- * @return Result of API execution status
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
- */
-static int8_t set_osr_settings(uint8_t desired_settings,
-                               const struct bme280_settings *settings,
-                               const struct bme280_dev *dev);
-
-/*!
- * @brief This API sets the pressure and/or temperature oversampling settings
- * in the sensor according to the settings selected by the user.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- * @param[in] desired_settings: variable to select the pressure and/or
- * temperature oversampling settings.
- *
- * @return Result of API execution status
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
- */
-static int8_t set_osr_press_temp_settings(uint8_t desired_settings,
-        const struct bme280_settings *settings,
-        const struct bme280_dev *dev);
-
-/*!
- * @brief This internal API fills the pressure oversampling settings provided by
- * the user in the data buffer so as to write in the sensor.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- * @param[out] reg_data : Variable which is filled according to the pressure
- * oversampling data provided by the user.
- */
-static void fill_osr_press_settings(uint8_t *reg_data, const struct bme280_settings *settings);
-
-/*!
- * @brief This internal API fills the temperature oversampling settings provided
- * by the user in the data buffer so as to write in the sensor.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- * @param[out] reg_data : Variable which is filled according to the temperature
- * oversampling data provided by the user.
- */
-static void fill_osr_temp_settings(uint8_t *reg_data, const struct bme280_settings *settings);
-
-/*!
- * @brief This internal API sets the filter and/or standby duration settings
- * in the sensor according to the settings selected by the user.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- * @param[in] desired_settings : variable to select the filter and/or
- * standby duration settings.
- *
- * @return Result of API execution status
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
- */
-static int8_t set_filter_standby_settings(uint8_t desired_settings,
-        const struct bme280_settings *settings,
-        const struct bme280_dev *dev);
-
-/*!
- * @brief This internal API fills the filter settings provided by the user
- * in the data buffer so as to write in the sensor.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- * @param[out] reg_data : Variable which is filled according to the filter
- * settings data provided by the user.
- */
-static void fill_filter_settings(uint8_t *reg_data, const struct bme280_settings *settings);
-
-/*!
- * @brief This internal API fills the standby duration settings provided by the
- * user in the data buffer so as to write in the sensor.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- * @param[out] reg_data : Variable which is filled according to the standby
- * settings data provided by the user.
- */
-static void fill_standby_settings(uint8_t *reg_data, const struct bme280_settings *settings);
-
-/*!
- * @brief This internal API parse the oversampling(pressure, temperature
- * and humidity), filter and standby duration settings and store in the
- * device structure.
- *
- * @param[out] dev : Structure instance of bme280_dev.
- * @param[in] reg_data : Register data to be parsed.
- */
-static void parse_device_settings(const uint8_t *reg_data, struct bme280_settings *settings);
-
-/*!
- * @brief This internal API reloads the already existing device settings in the
- * sensor after soft reset.
- *
- * @param[in] dev : Structure instance of bme280_dev.
- * @param[in] settings : Pointer variable which contains the settings to
- * be set in the sensor.
- *
- * @return Result of API execution status
- * @retval zero -> Success / +ve value -> Warning / -ve value -> Error
- */
-static int8_t reload_device_settings(const struct bme280_settings *settings, const struct bme280_dev *dev);
 
 /****************** Global Function Definitions *******************************/
 
@@ -753,7 +464,7 @@
  * @brief This internal API sets the oversampling settings for pressure,
  * temperature and humidity in the sensor.
  */
-static int8_t BME280::set_osr_settings(uint8_t desired_settings,
+int8_t BME280::set_osr_settings(uint8_t desired_settings,
                                        const struct bme280_settings *settings,
                                        const struct bme280_dev *dev)
 {
@@ -772,7 +483,7 @@
 /*!
  * @brief This API sets the humidity oversampling settings of the sensor.
  */
-static int8_t BME280::set_osr_humidity_settings(const struct bme280_settings *settings, const struct bme280_dev *dev)
+int8_t BME280::set_osr_humidity_settings(const struct bme280_settings *settings, const struct bme280_dev *dev)
 {
     int8_t rslt;
     uint8_t ctrl_hum;
@@ -802,7 +513,7 @@
  * @brief This API sets the pressure and/or temperature oversampling settings
  * in the sensor according to the settings selected by the user.
  */
-static int8_t BME280::set_osr_press_temp_settings(uint8_t desired_settings,
+int8_t BME280::set_osr_press_temp_settings(uint8_t desired_settings,
         const struct bme280_settings *settings,
         const struct bme280_dev *dev)
 {
@@ -830,7 +541,7 @@
  * @brief This internal API sets the filter and/or standby duration settings
  * in the sensor according to the settings selected by the user.
  */
-static int8_t BME280::set_filter_standby_settings(uint8_t desired_settings,
+int8_t BME280::set_filter_standby_settings(uint8_t desired_settings,
         const struct bme280_settings *settings,
         const struct bme280_dev *dev)
 {
@@ -858,7 +569,7 @@
  * @brief This internal API fills the filter settings provided by the user
  * in the data buffer so as to write in the sensor.
  */
-static void BME280::fill_filter_settings(uint8_t *reg_data, const struct bme280_settings *settings)
+void BME280::fill_filter_settings(uint8_t *reg_data, const struct bme280_settings *settings)
 {
     *reg_data = BME280_SET_BITS(*reg_data, BME280_FILTER, settings->filter);
 }
@@ -867,7 +578,7 @@
  * @brief This internal API fills the standby duration settings provided by
  * the user in the data buffer so as to write in the sensor.
  */
-static void BME280::fill_standby_settings(uint8_t *reg_data, const struct bme280_settings *settings)
+void BME280::fill_standby_settings(uint8_t *reg_data, const struct bme280_settings *settings)
 {
     *reg_data = BME280_SET_BITS(*reg_data, BME280_STANDBY, settings->standby_time);
 }
@@ -876,7 +587,7 @@
  * @brief This internal API fills the pressure oversampling settings provided by
  * the user in the data buffer so as to write in the sensor.
  */
-static void BME280::fill_osr_press_settings(uint8_t *reg_data, const struct bme280_settings *settings)
+void BME280::fill_osr_press_settings(uint8_t *reg_data, const struct bme280_settings *settings)
 {
     *reg_data = BME280_SET_BITS(*reg_data, BME280_CTRL_PRESS, settings->osr_p);
 }
@@ -885,7 +596,7 @@
  * @brief This internal API fills the temperature oversampling settings
  * provided by the user in the data buffer so as to write in the sensor.
  */
-static void BME280::fill_osr_temp_settings(uint8_t *reg_data, const struct bme280_settings *settings)
+void BME280::fill_osr_temp_settings(uint8_t *reg_data, const struct bme280_settings *settings)
 {
     *reg_data = BME280_SET_BITS(*reg_data, BME280_CTRL_TEMP, settings->osr_t);
 }
@@ -895,7 +606,7 @@
  * and humidity), filter and standby duration settings and store in the
  * device structure.
  */
-static void BME280::parse_device_settings(const uint8_t *reg_data, struct bme280_settings *settings)
+void BME280::parse_device_settings(const uint8_t *reg_data, struct bme280_settings *settings)
 {
     settings->osr_h = BME280_GET_BITS_POS_0(reg_data[0], BME280_CTRL_HUM);
     settings->osr_p = BME280_GET_BITS(reg_data[2], BME280_CTRL_PRESS);
@@ -907,7 +618,7 @@
 /*!
  * @brief This internal API writes the power mode in the sensor.
  */
-static int8_t BME280::write_power_mode(uint8_t sensor_mode, const struct bme280_dev *dev)
+int8_t BME280::write_power_mode(uint8_t sensor_mode, const struct bme280_dev *dev)
 {
     int8_t rslt;
     uint8_t reg_addr = BME280_PWR_CTRL_ADDR;
@@ -932,7 +643,7 @@
 /*!
  * @brief This internal API puts the device to sleep mode.
  */
-static int8_t BME280::put_device_to_sleep(const struct bme280_dev *dev)
+int8_t BME280::put_device_to_sleep(const struct bme280_dev *dev)
 {
     int8_t rslt;
     uint8_t reg_data[4];
@@ -954,7 +665,7 @@
  * @brief This internal API reloads the already existing device settings in
  * the sensor after soft reset.
  */
-static int8_t BME280::reload_device_settings(const struct bme280_settings *settings, const struct bme280_dev *dev)
+int8_t BME280::reload_device_settings(const struct bme280_settings *settings, const struct bme280_dev *dev)
 {
     int8_t rslt;
 
@@ -972,7 +683,7 @@
  * @brief This internal API is used to compensate the raw temperature data and
  * return the compensated temperature data in double data type.
  */
-static double BME280::compensate_temperature(const struct bme280_uncomp_data *uncomp_data, struct bme280_calib_data *calib_data)
+double BME280::compensate_temperature(const struct bme280_uncomp_data *uncomp_data, struct bme280_calib_data *calib_data)
 {
     double var1;
     double var2;
@@ -999,7 +710,7 @@
  * @brief This internal API is used to compensate the raw pressure data and
  * return the compensated pressure data in double data type.
  */
-static double BME280::compensate_pressure(const struct bme280_uncomp_data *uncomp_data,
+double BME280::compensate_pressure(const struct bme280_uncomp_data *uncomp_data,
         const struct bme280_calib_data *calib_data)
 {
     double var1;
@@ -1040,7 +751,7 @@
  * @brief This internal API is used to compensate the raw humidity data and
  * return the compensated humidity data in double data type.
  */
-static double BME280::compensate_humidity(const struct bme280_uncomp_data *uncomp_data,
+double BME280::compensate_humidity(const struct bme280_uncomp_data *uncomp_data,
         const struct bme280_calib_data *calib_data)
 {
     double humidity;
@@ -1076,7 +787,7 @@
  * @brief This internal API is used to compensate the raw temperature data and
  * return the compensated temperature data in integer data type.
  */
-static int32_t BME280::compensate_temperature(const struct bme280_uncomp_data *uncomp_data,
+int32_t BME280::compensate_temperature(const struct bme280_uncomp_data *uncomp_data,
         struct bme280_calib_data *calib_data)
 {
     int32_t var1;
@@ -1106,7 +817,7 @@
  * return the compensated pressure data in integer data type with higher
  * accuracy.
  */
-static uint32_t BME280::compensate_pressure(const struct bme280_uncomp_data *uncomp_data,
+uint32_t BME280::compensate_pressure(const struct bme280_uncomp_data *uncomp_data,
         const struct bme280_calib_data *calib_data)
 {
     int64_t var1;
@@ -1150,7 +861,7 @@
  * @brief This internal API is used to compensate the raw pressure data and
  * return the compensated pressure data in integer data type.
  */
-static uint32_t BME280::compensate_pressure(const struct bme280_uncomp_data *uncomp_data,
+uint32_t BME280::compensate_pressure(const struct bme280_uncomp_data *uncomp_data,
         const struct bme280_calib_data *calib_data)
 {
     int32_t var1;
@@ -1200,7 +911,7 @@
  * @brief This internal API is used to compensate the raw humidity data and
  * return the compensated humidity data in integer data type.
  */
-static uint32_t BME280::compensate_humidity(const struct bme280_uncomp_data *uncomp_data,
+uint32_t BME280::compensate_humidity(const struct bme280_uncomp_data *uncomp_data,
         const struct bme280_calib_data *calib_data)
 {
     int32_t var1;
@@ -1238,7 +949,7 @@
  * @brief This internal API reads the calibration data from the sensor, parse
  * it and store in the device structure.
  */
-static int8_t BME280::get_calib_data(struct bme280_dev *dev)
+int8_t BME280::get_calib_data(struct bme280_dev *dev)
 {
     int8_t rslt;
     uint8_t reg_addr = BME280_TEMP_PRESS_CALIB_DATA_ADDR;
@@ -1272,7 +983,7 @@
  * @brief This internal API interleaves the register address between the
  * register data buffer for burst write operation.
  */
-static void BME280::interleave_reg_addr(const uint8_t *reg_addr, uint8_t *temp_buff, const uint8_t *reg_data, uint8_t len)
+void BME280::interleave_reg_addr(const uint8_t *reg_addr, uint8_t *temp_buff, const uint8_t *reg_data, uint8_t len)
 {
     uint8_t index;
 
@@ -1286,7 +997,7 @@
  *  @brief This internal API is used to parse the temperature and
  *  pressure calibration data and store it in device structure.
  */
-static void BME280::parse_temp_press_calib_data(const uint8_t *reg_data, struct bme280_dev *dev)
+void BME280::parse_temp_press_calib_data(const uint8_t *reg_data, struct bme280_dev *dev)
 {
     struct bme280_calib_data *calib_data = &dev->calib_data;
 
@@ -1309,7 +1020,7 @@
  *  @brief This internal API is used to parse the humidity calibration data
  *  and store it in device structure.
  */
-static void BME280::parse_humidity_calib_data(const uint8_t *reg_data, struct bme280_dev *dev)
+void BME280::parse_humidity_calib_data(const uint8_t *reg_data, struct bme280_dev *dev)
 {
     struct bme280_calib_data *calib_data = &dev->calib_data;
     int16_t dig_H4_lsb;
@@ -1332,7 +1043,7 @@
  * @brief This internal API is used to identify the settings which the user
  * wants to modify in the sensor.
  */
-static uint8_t BME280::are_settings_changed(uint8_t sub_settings, uint8_t desired_settings)
+uint8_t BME280::are_settings_changed(uint8_t sub_settings, uint8_t desired_settings)
 {
     uint8_t settings_changed = FALSE;
 
@@ -1351,7 +1062,7 @@
  * @brief This internal API is used to validate the device structure pointer for
  * null conditions.
  */
-static int8_t BME280::null_ptr_check(const struct bme280_dev *dev)
+int8_t BME280::null_ptr_check(const struct bme280_dev *dev)
 {
     int8_t rslt;