Class that stores state and functions for interacting with BME280 IC.
More...
#include <Adafruit_BME280.h>
|
enum | sensor_sampling {
SAMPLING_NONE = 0b000,
SAMPLING_X1 = 0b001,
SAMPLING_X2 = 0b010,
SAMPLING_X4 = 0b011,
SAMPLING_X8 = 0b100,
SAMPLING_X16 = 0b101
} |
| sampling rates
|
|
enum | sensor_mode { MODE_SLEEP = 0b00,
MODE_FORCED = 0b01,
MODE_NORMAL = 0b11
} |
| power modes
|
|
enum | sensor_filter {
FILTER_OFF = 0b000,
FILTER_X2 = 0b001,
FILTER_X4 = 0b010,
FILTER_X8 = 0b011,
FILTER_X16 = 0b100
} |
| filter values
|
|
enum | standby_duration {
STANDBY_MS_0_5 = 0b000,
STANDBY_MS_10 = 0b110,
STANDBY_MS_20 = 0b111,
STANDBY_MS_62_5 = 0b001,
STANDBY_MS_125 = 0b010,
STANDBY_MS_250 = 0b011,
STANDBY_MS_500 = 0b100,
STANDBY_MS_1000 = 0b101
} |
| standby duration in ms
|
|
|
| Adafruit_BME280 () |
| class constructor
|
|
| Adafruit_BME280 (int8_t cspin, SPIClass *theSPI=&SPI) |
| class constructor if using hardware SPI More...
|
|
| Adafruit_BME280 (int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin) |
| class constructor if using software SPI More...
|
|
bool | begin (uint8_t addr=BME280_ADDRESS, TwoWire *theWire=&Wire) |
| Initialise sensor with given parameters / settings. More...
|
|
bool | init () |
| Initialise sensor with given parameters / settings. More...
|
|
void | setSampling (sensor_mode mode=MODE_NORMAL, sensor_sampling tempSampling=SAMPLING_X16, sensor_sampling pressSampling=SAMPLING_X16, sensor_sampling humSampling=SAMPLING_X16, sensor_filter filter=FILTER_OFF, standby_duration duration=STANDBY_MS_0_5) |
| setup sensor with given parameters / settings More...
|
|
bool | takeForcedMeasurement (void) |
| Take a new measurement (only possible in forced mode) More...
|
|
float | readTemperature (void) |
| Returns the temperature from the sensor. More...
|
|
float | readPressure (void) |
| Returns the pressure from the sensor. More...
|
|
float | readHumidity (void) |
| Returns the humidity from the sensor. More...
|
|
float | readAltitude (float seaLevel) |
|
float | seaLevelForAltitude (float altitude, float pressure) |
|
uint32_t | sensorID (void) |
|
float | getTemperatureCompensation (void) |
|
void | setTemperatureCompensation (float) |
|
Adafruit_Sensor * | getTemperatureSensor (void) |
| Gets an Adafruit Unified Sensor object for the temp sensor component. More...
|
|
Adafruit_Sensor * | getPressureSensor (void) |
| Gets an Adafruit Unified Sensor object for the pressure sensor component. More...
|
|
Adafruit_Sensor * | getHumiditySensor (void) |
| Gets an Adafruit Unified Sensor object for the humidity sensor component. More...
|
|
|
void | readCoefficients (void) |
| Reads the factory-set coefficients.
|
|
bool | isReadingCalibration (void) |
| return true if chip is busy reading cal data More...
|
|
void | write8 (byte reg, byte value) |
| Writes an 8 bit value over I2C or SPI. More...
|
|
uint8_t | read8 (byte reg) |
| Reads an 8 bit value over I2C or SPI. More...
|
|
uint16_t | read16 (byte reg) |
| Reads a 16 bit value over I2C or SPI. More...
|
|
uint32_t | read24 (byte reg) |
| Reads a 24 bit value over I2C. More...
|
|
int16_t | readS16 (byte reg) |
| Reads a signed 16 bit value over I2C or SPI. More...
|
|
uint16_t | read16_LE (byte reg) |
| Reads a signed 16 bit little endian value over I2C or SPI. More...
|
|
int16_t | readS16_LE (byte reg) |
| Reads a signed little endian 16 bit value over I2C or SPI. More...
|
|
Class that stores state and functions for interacting with BME280 IC.
◆ Adafruit_BME280() [1/2]
Adafruit_BME280::Adafruit_BME280 |
( |
int8_t |
cspin, |
|
|
SPIClass * |
theSPI = &SPI |
|
) |
| |
class constructor if using hardware SPI
- Parameters
-
cspin | the chip select pin to use |
*theSPI | optional SPI object |
◆ Adafruit_BME280() [2/2]
Adafruit_BME280::Adafruit_BME280 |
( |
int8_t |
cspin, |
|
|
int8_t |
mosipin, |
|
|
int8_t |
misopin, |
|
|
int8_t |
sckpin |
|
) |
| |
class constructor if using software SPI
- Parameters
-
cspin | the chip select pin to use |
mosipin | the MOSI pin to use |
misopin | the MISO pin to use |
sckpin | the SCK pin to use |
◆ begin()
bool Adafruit_BME280::begin |
( |
uint8_t |
addr = BME280_ADDRESS , |
|
|
TwoWire * |
theWire = &Wire |
|
) |
| |
Initialise sensor with given parameters / settings.
- Parameters
-
addr | the I2C address the device can be found on |
theWire | the I2C object to use, defaults to &Wire |
- Returns
- true on success, false otherwise
◆ init()
bool Adafruit_BME280::init |
( |
| ) |
|
Initialise sensor with given parameters / settings.
- Returns
- true on success, false otherwise
◆ setSampling()
setup sensor with given parameters / settings
- Parameters
-
mode | the power mode to use for the sensor |
tempSampling | the temp samping rate to use |
pressSampling | the pressure sampling rate to use |
humSampling | the humidity sampling rate to use |
filter | the filter mode to use |
duration | the standby duration to use |
◆ takeForcedMeasurement()
bool Adafruit_BME280::takeForcedMeasurement |
( |
void |
| ) |
|
Take a new measurement (only possible in forced mode)
- Returns
- true in case of success else false
◆ readTemperature()
float Adafruit_BME280::readTemperature |
( |
void |
| ) |
|
Returns the temperature from the sensor.
- Returns
- the temperature read from the device or NaN if sampling off
◆ readPressure()
float Adafruit_BME280::readPressure |
( |
void |
| ) |
|
Returns the pressure from the sensor.
- Returns
- the pressure value (in Pascal) or NaN if sampling off
◆ readHumidity()
float Adafruit_BME280::readHumidity |
( |
void |
| ) |
|
Returns the humidity from the sensor.
- Returns
- the humidity value read from the device or NaN if sampling off
◆ readAltitude()
float Adafruit_BME280::readAltitude |
( |
float |
seaLevel | ) |
|
Calculates the altitude (in meters) from the specified atmospheric pressure (in hPa), and sea-level pressure (in hPa).
- Parameters
-
seaLevel | Sea-level pressure in hPa |
- Returns
- the altitude value read from the device
◆ seaLevelForAltitude()
float Adafruit_BME280::seaLevelForAltitude |
( |
float |
altitude, |
|
|
float |
atmospheric |
|
) |
| |
Calculates the pressure at sea level (in hPa) from the specified altitude (in meters), and atmospheric pressure (in hPa).
- Parameters
-
altitude | Altitude in meters |
atmospheric | Atmospheric pressure in hPa |
- Returns
- the pressure at sea level (in hPa) from the specified altitude
◆ sensorID()
uint32_t Adafruit_BME280::sensorID |
( |
void |
| ) |
|
Returns Sensor ID found by init() for diagnostics
- Returns
- Sensor ID 0x60 for BME280, 0x56, 0x57, 0x58 BMP280
◆ getTemperatureCompensation()
float Adafruit_BME280::getTemperatureCompensation |
( |
void |
| ) |
|
Returns the current temperature compensation value in degrees Celsius
- Returns
- the current temperature compensation value in degrees Celsius
◆ setTemperatureCompensation()
void Adafruit_BME280::setTemperatureCompensation |
( |
float |
adjustment | ) |
|
Sets a value to be added to each temperature reading. This adjusted temperature is used in pressure and humidity readings.
- Parameters
-
adjustment | Value to be added to each temperature reading in Celsius |
◆ getTemperatureSensor()
Adafruit_Sensor * Adafruit_BME280::getTemperatureSensor |
( |
void |
| ) |
|
Gets an Adafruit Unified Sensor object for the temp sensor component.
- Returns
- Adafruit_Sensor pointer to temperature sensor
◆ getPressureSensor()
Adafruit_Sensor * Adafruit_BME280::getPressureSensor |
( |
void |
| ) |
|
Gets an Adafruit Unified Sensor object for the pressure sensor component.
- Returns
- Adafruit_Sensor pointer to pressure sensor
◆ getHumiditySensor()
Adafruit_Sensor * Adafruit_BME280::getHumiditySensor |
( |
void |
| ) |
|
Gets an Adafruit Unified Sensor object for the humidity sensor component.
- Returns
- Adafruit_Sensor pointer to humidity sensor
◆ isReadingCalibration()
bool Adafruit_BME280::isReadingCalibration |
( |
void |
| ) |
|
|
protected |
return true if chip is busy reading cal data
- Returns
- true if reading calibration, false otherwise
◆ write8()
void Adafruit_BME280::write8 |
( |
byte |
reg, |
|
|
byte |
value |
|
) |
| |
|
protected |
Writes an 8 bit value over I2C or SPI.
- Parameters
-
reg | the register address to write to |
value | the value to write to the register |
◆ read8()
uint8_t Adafruit_BME280::read8 |
( |
byte |
reg | ) |
|
|
protected |
Reads an 8 bit value over I2C or SPI.
- Parameters
-
reg | the register address to read from |
- Returns
- the data byte read from the device
◆ read16()
uint16_t Adafruit_BME280::read16 |
( |
byte |
reg | ) |
|
|
protected |
Reads a 16 bit value over I2C or SPI.
- Parameters
-
reg | the register address to read from |
- Returns
- the 16 bit data value read from the device
◆ read24()
uint32_t Adafruit_BME280::read24 |
( |
byte |
reg | ) |
|
|
protected |
Reads a 24 bit value over I2C.
- Parameters
-
reg | the register address to read from |
- Returns
- the 24 bit data value read from the device
◆ readS16()
int16_t Adafruit_BME280::readS16 |
( |
byte |
reg | ) |
|
|
protected |
Reads a signed 16 bit value over I2C or SPI.
- Parameters
-
reg | the register address to read from |
- Returns
- the 16 bit data value read from the device
◆ read16_LE()
uint16_t Adafruit_BME280::read16_LE |
( |
byte |
reg | ) |
|
|
protected |
Reads a signed 16 bit little endian value over I2C or SPI.
- Parameters
-
reg | the register address to read from |
- Returns
- the 16 bit data value read from the device
◆ readS16_LE()
int16_t Adafruit_BME280::readS16_LE |
( |
byte |
reg | ) |
|
|
protected |
Reads a signed little endian 16 bit value over I2C or SPI.
- Parameters
-
reg | the register address to read from |
- Returns
- the 16 bit data value read from the device
◆ t_fine
int32_t Adafruit_BME280::t_fine |
|
protected |
temperature with high resolution, stored as an attribute as this is used for temperature compensation reading humidity and pressure
◆ t_fine_adjust
int32_t Adafruit_BME280::t_fine_adjust = 0 |
|
protected |
add to compensate temp readings and in turn to pressure and humidity readings
The documentation for this class was generated from the following files: