Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BME280.h
00001 #ifndef BME280_H 00002 #define BME280_H 00003 00004 #include "mbed.h" 00005 00006 #define BME280_ADDR_H (0x77) 00007 #define BME280_ADDR_L (0x76) 00008 00009 #define BME280_CTRL_HUM (0xF2) 00010 #define BME280_CTRL_MEAS (0xF4) 00011 00012 typedef enum { 00013 BME280_SAMPLING_X1 = 0x01, 00014 BME280_SAMPLING_X2 = 0x02, 00015 BME280_SAMPLING_X4 = 0x03, 00016 BME280_SAMPLING_X8 = 0x04, 00017 BME280_SAMPLING_X16 = 0x05, 00018 } bme280_sampling_t; 00019 00020 typedef enum{ 00021 BME280_MODE_SLEEP = 0x00, 00022 BME280_MODE_FORCED1 = 0x01, 00023 BME280_MODE_FORCED2 = 0x02, 00024 BME280_MODE_NORMAL = 0x03, 00025 } bme280_mode_t; 00026 00027 class BME280 00028 { 00029 public: 00030 BME280(I2C& bme280_i2c, uint8_t bme280_addr=BME280_ADDR_H); 00031 //virtual ~BME280(); 00032 bool init(void); 00033 float getTemperature(void); 00034 float getPressure(void); 00035 float getHumidity(void); 00036 00037 protected: 00038 I2C _i2c; 00039 uint8_t _addr; 00040 bool _init; 00041 uint16_t dig_T1; 00042 int16_t dig_T2, dig_T3; 00043 uint16_t dig_P1; 00044 int16_t dig_P2, dig_P3, dig_P4, dig_P5, dig_P6, dig_P7, dig_P8, dig_P9; 00045 uint16_t dig_H1, dig_H3; 00046 int16_t dig_H2, dig_H4, dig_H5, dig_H6; 00047 int32_t t_fine; 00048 }; 00049 00050 #endif
Generated on Sun Jul 17 2022 18:52:39 by
1.7.2