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.
Diff: BMP280.h
- Revision:
- 9:256989faeb3b
- Parent:
- 6:b2672da545f1
--- a/BMP280.h Thu Apr 09 03:18:31 2020 +0000 +++ b/BMP280.h Fri Apr 10 11:56:58 2020 +0000 @@ -14,14 +14,14 @@ #pragma once #ifndef BME280MbedDecl #define BME280MbedDecl - + #include <mbedBug.h> - + //#define _DEBUG -// default address with SDO High 0x77 -// address with SDO LOW 0x76 +// default BusAddress with SDO High 0x77 +// BusAddress with SDO LOW 0x76 #define BMP280SlaveAddressDefault (0x77) - + /** A BME280 environmental sensor A library to read environmental temperature and pressure using Bosch BME280. */ @@ -30,44 +30,35 @@ public: enum { - // The default I2C slave address. + // The default I2C slave BusAddress. SlaveAddress = BMP280SlaveAddressDefault }; - - /* Creates a BME280 instance connected to specified I2C pins and address. - @param SDA I2C-bus SDA pin - @param SCL I2C-bus SCL pin - @param SlaveAddress (option) I2C-bus address (default: 0x77) */ - BMP280(PinName SDA, PinName SCK, - char SlaveAddress = BMP280SlaveAddressDefault); - - /* Creates a BME280 instance connected to the I2C pins and address. + + /* Creates a BME280 instance connected to the I2C pins and BusAddress. * * @param i2c_obj I2C object (instance) - * @param SlaveAddress (option) I2C-bus address (default: 0x77) + * @param SlaveAddress (option) I2C-bus BusAddress (default: 0x77) */ BMP280(I2C &Bus, char SlaveAddress = BMP280SlaveAddressDefault); - - ~BMP280(); - + /* Initializa BME280 sensor Configure sensor setting and read parameters for calibration */ void Initialize(); - + /* Read the current temperature value (degree Celsius) from BME280 sensor */ - float Temperature(); - + int32_t Temperature(); + /* Read the current pressure value (hectopascal)from BME280 sensor */ - float Pressure(); - + uint32_t Pressure(); + /* Read the current humidity value (humidity %) from BME280 sensor */ //float HumidityGet(); - + private: - + I2C *i2c_p; - I2C &i2c; - char address; + I2C &Bus; + char BusAddress; uint16_t dig_T1; int16_t dig_T2, dig_T3; uint16_t dig_P1; @@ -75,8 +66,9 @@ uint16_t dig_H1, dig_H3; int16_t dig_H2, dig_H4, dig_H5, dig_H6; int32_t t_fine; - + }; - + #undef SlaveAddressDefault #endif + \ No newline at end of file