]> git.itanic.dy.fi Git - BME280_driver/blobdiff - bme280_defs.h
- Changed macro FLOATING_POINT_REPRESENTATION to BME280_FLOAT_ENABLE
[BME280_driver] / bme280_defs.h
index f86db481c21a70aabfa5e3272c6358d9394de5f5..2398b2caf9deb1308ba30b63f60f6ae8b02bb088 100644 (file)
@@ -40,8 +40,8 @@
  * patent rights of the copyright holder.
  *
  * @file       bme280_defs.h
- * @date       21 Mar 2017
- * @version    3.2.0
+ * @date       13 Jul 2017
+ * @version    3.3.0
  * @brief
  *
  */
 #endif
 #endif
 
-/* #define FLOATING_POINT_REPRESENTATION */
-#define MACHINE_64_BIT
+#ifndef BME280_FLOAT_ENABLE
+//#define BME280_FLOAT_ENABLE
+#endif
+
+#ifndef BME280_FLOAT_ENABLE
+#      ifndef BME280_64BIT_ENABLE
+#              define BME280_64BIT_ENABLE
+#      endif
+#endif
 
 #ifndef TRUE
 #define TRUE                UINT8_C(1)
 #endif
 
 /**\name I2C addresses */
-#define BME280_I2C_ADDR_PRIM           UINT8_C(0x76)
+#define BME280_I2C_ADDR_PRIM   UINT8_C(0x76)
 #define BME280_I2C_ADDR_SEC            UINT8_C(0x77)
 
 /**\name BME280 chip identifier */
 #define BME280_CHIP_ID  UINT8_C(0x60)
 
 /**\name Register Address */
-#define BME280_CHIP_ID_ADDR                    UINT8_C(0xD0)
-#define BME280_RESET_ADDR                      UINT8_C(0xE0)
+#define BME280_CHIP_ID_ADDR                                    UINT8_C(0xD0)
+#define BME280_RESET_ADDR                                      UINT8_C(0xE0)
 #define BME280_TEMP_PRESS_CALIB_DATA_ADDR      UINT8_C(0x88)
 #define BME280_HUMIDITY_CALIB_DATA_ADDR                UINT8_C(0xE1)
-#define BME280_PWR_CTRL_ADDR                   UINT8_C(0xF4)
-#define BME280_CTRL_HUM_ADDR                   UINT8_C(0xF2)
-#define BME280_CTRL_MEAS_ADDR                  UINT8_C(0xF4)
-#define BME280_CONFIG_ADDR                     UINT8_C(0xF5)
-#define BME280_DATA_ADDR                       UINT8_C(0xF7)
+#define BME280_PWR_CTRL_ADDR                           UINT8_C(0xF4)
+#define BME280_CTRL_HUM_ADDR                           UINT8_C(0xF2)
+#define BME280_CTRL_MEAS_ADDR                          UINT8_C(0xF4)
+#define BME280_CONFIG_ADDR                                     UINT8_C(0xF5)
+#define BME280_DATA_ADDR                                       UINT8_C(0xF7)
 
 /**\name API success code */
-#define BME280_OK                              INT8_C(0)
+#define BME280_OK                                      INT8_C(0)
 /**\name API error codes */
 #define BME280_E_NULL_PTR                      INT8_C(-1)
-#define BME280_E_DEV_NOT_FOUND                 INT8_C(-2)
-#define BME280_E_INVALID_LEN                   INT8_C(-3)
+#define BME280_E_DEV_NOT_FOUND         INT8_C(-2)
+#define BME280_E_INVALID_LEN           INT8_C(-3)
 #define BME280_E_COMM_FAIL                     INT8_C(-4)
-#define BME280_E_SLEEP_MODE_FAIL               INT8_C(-5)
+#define BME280_E_SLEEP_MODE_FAIL       INT8_C(-5)
 /**\name API warning codes */
-#define BME280_W_INVALID_OSR_MACRO             UINT8_C(1)
+#define BME280_W_INVALID_OSR_MACRO     UINT8_C(1)
 
 /**\name Macros related to size */
 #define BME280_TEMP_PRESS_CALIB_DATA_LEN       UINT8_C(26)
 #define BME280_HUMIDITY_CALIB_DATA_LEN         UINT8_C(7)
-#define BME280_P_T_H_DATA_LEN                  UINT8_C(8)
+#define BME280_P_T_H_DATA_LEN                          UINT8_C(8)
 
 /**\name Sensor power modes */
-#define        BME280_SLEEP_MODE                       UINT8_C(0x00)
-#define        BME280_FORCED_MODE                      UINT8_C(0x01)
-#define        BME280_NORMAL_MODE                      UINT8_C(0x03)
+#define        BME280_SLEEP_MODE               UINT8_C(0x00)
+#define        BME280_FORCED_MODE              UINT8_C(0x01)
+#define        BME280_NORMAL_MODE              UINT8_C(0x03)
 
 /**\name Macro to combine two 8 bit data's to form a 16 bit data */
 #define BME280_CONCAT_BYTES(msb, lsb)     (((uint16_t)msb << 8) | (uint16_t)lsb)
 #define BME280_GET_BITS_POS_0(reg_data, bitname)  (reg_data & (bitname##_MSK))
 
 /**\name Macros for bit masking */
-#define BME280_SENSOR_MODE_MSK         UINT8_C(0x03)
-#define BME280_SENSOR_MODE_POS         UINT8_C(0x00)
+#define BME280_SENSOR_MODE_MSK UINT8_C(0x03)
+#define BME280_SENSOR_MODE_POS UINT8_C(0x00)
 
 #define BME280_CTRL_HUM_MSK            UINT8_C(0x07)
 #define BME280_CTRL_HUM_POS            UINT8_C(0x00)
 
-#define BME280_CTRL_PRESS_MSK          UINT8_C(0x1C)
-#define BME280_CTRL_PRESS_POS          UINT8_C(0x02)
+#define BME280_CTRL_PRESS_MSK  UINT8_C(0x1C)
+#define BME280_CTRL_PRESS_POS  UINT8_C(0x02)
 
-#define BME280_CTRL_TEMP_MSK           UINT8_C(0xE0)
-#define BME280_CTRL_TEMP_POS           UINT8_C(0x05)
+#define BME280_CTRL_TEMP_MSK   UINT8_C(0xE0)
+#define BME280_CTRL_TEMP_POS   UINT8_C(0x05)
 
 #define BME280_FILTER_MSK              UINT8_C(0x1C)
 #define BME280_FILTER_POS              UINT8_C(0x02)
 /**\name Sensor component selection macros
    These values are internal for API implementation. Don't relate this to
    data sheet.*/
-#define BME280_PRESS                   UINT8_C(1)
+#define BME280_PRESS           UINT8_C(1)
 #define BME280_TEMP                    UINT8_C(1 << 1)
 #define BME280_HUM                     UINT8_C(1 << 2)
 #define BME280_ALL                     UINT8_C(0x07)
 
 /**\name Settings selection macros */
 #define BME280_OSR_PRESS_SEL           UINT8_C(1)
-#define BME280_OSR_TEMP_SEL            UINT8_C(1 << 1)
-#define BME280_OSR_HUM_SEL             UINT8_C(1 << 2)
-#define BME280_FILTER_SEL              UINT8_C(1 << 3)
-#define BME280_STANDBY_SEL             UINT8_C(1 << 4)
-#define BME280_ALL_SETTINGS_SEL        UINT8_C(0x1F)
+#define BME280_OSR_TEMP_SEL                    UINT8_C(1 << 1)
+#define BME280_OSR_HUM_SEL                     UINT8_C(1 << 2)
+#define BME280_FILTER_SEL                      UINT8_C(1 << 3)
+#define BME280_STANDBY_SEL                     UINT8_C(1 << 4)
+#define BME280_ALL_SETTINGS_SEL                UINT8_C(0x1F)
 
 /**\name Oversampling macros */
 #define BME280_NO_OVERSAMPLING         UINT8_C(0x00)
 
 /**\name Standby duration selection macros */
 #define BME280_STANDBY_TIME_1_MS              (0x00)
-#define BME280_STANDBY_TIME_62_5_MS             (0x01)
+#define BME280_STANDBY_TIME_62_5_MS           (0x01)
 #define BME280_STANDBY_TIME_125_MS                       (0x02)
 #define BME280_STANDBY_TIME_250_MS            (0x03)
 #define BME280_STANDBY_TIME_500_MS            (0x04)
@@ -295,7 +302,7 @@ struct bme280_calib_data {
  * @brief bme280 sensor structure which comprises of temperature, pressure and
  * humidity data
  */
-#ifdef FLOATING_POINT_REPRESENTATION
+#ifdef BME280_FLOAT_ENABLE
 struct bme280_data {
        /*! Compensated pressure */
        double pressure;
@@ -352,9 +359,9 @@ struct bme280_dev {
        /*! Chip Id */
        uint8_t chip_id;
        /*! Device Id */
-       uint8_t id;
+       uint8_t dev_id;
        /*! SPI/I2C interface */
-       enum bme280_intf interface;
+       enum bme280_intf intf;
        /*! Read function pointer */
        bme280_com_fptr_t read;
        /*! Write function pointer */