Adafruit BMP280 Library
|
#include <Adafruit_BMP280.h>
Public Types | |
enum | sensor_sampling { SAMPLING_NONE = 0x00, SAMPLING_X1 = 0x01, SAMPLING_X2 = 0x02, SAMPLING_X4 = 0x03, SAMPLING_X8 = 0x04, SAMPLING_X16 = 0x05 } |
enum | sensor_mode { MODE_SLEEP = 0x00, MODE_FORCED = 0x01, MODE_NORMAL = 0x03, MODE_SOFT_RESET_CODE = 0xB6 } |
enum | sensor_filter { FILTER_OFF = 0x00, FILTER_X2 = 0x01, FILTER_X4 = 0x02, FILTER_X8 = 0x03, FILTER_X16 = 0x04 } |
enum | standby_duration { STANDBY_MS_1 = 0x00, STANDBY_MS_63 = 0x01, STANDBY_MS_125 = 0x02, STANDBY_MS_250 = 0x03, STANDBY_MS_500 = 0x04, STANDBY_MS_1000 = 0x05, STANDBY_MS_2000 = 0x06, STANDBY_MS_4000 = 0x07 } |
Public Member Functions | |
Adafruit_BMP280 (TwoWire *theWire=&Wire) | |
BMP280 constructor using i2c. More... | |
Adafruit_BMP280 (int8_t cspin, SPIClass *theSPI=&SPI) | |
BMP280 constructor using hardware SPI. More... | |
Adafruit_BMP280 (int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin) | |
BMP280 constructor using bitbang SPI. More... | |
bool | begin (uint8_t addr=BMP280_ADDRESS, uint8_t chipid=BMP280_CHIPID) |
void | reset (void) |
Resets the chip via soft reset. | |
uint8_t | getStatus (void) |
Gets the most recent sensor event from the hardware status register. More... | |
uint8_t | sensorID (void) |
float | readTemperature () |
float | readPressure (void) |
float | readAltitude (float seaLevelhPa=1013.25) |
Calculates the approximate altitude using barometric pressure and the supplied sea level hPa as a reference. More... | |
float | seaLevelForAltitude (float altitude, float atmospheric) |
float | waterBoilingPoint (float pressure) |
calculates the boiling point of water by a given pressure More... | |
bool | takeForcedMeasurement () |
Take a new measurement (only possible in forced mode) More... | |
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... | |
void | setSampling (sensor_mode mode=MODE_NORMAL, sensor_sampling tempSampling=SAMPLING_X16, sensor_sampling pressSampling=SAMPLING_X16, sensor_filter filter=FILTER_OFF, standby_duration duration=STANDBY_MS_1) |
Driver for the Adafruit BMP280 barometric pressure sensor.
Adafruit_BMP280::Adafruit_BMP280 | ( | TwoWire * | theWire = &Wire | ) |
BMP280 constructor using i2c.
*theWire | optional wire |
Adafruit_BMP280::Adafruit_BMP280 | ( | int8_t | cspin, |
SPIClass * | theSPI = &SPI |
||
) |
BMP280 constructor using hardware SPI.
cspin | cs pin number |
theSPI | optional SPI object |
Adafruit_BMP280::Adafruit_BMP280 | ( | int8_t | cspin, |
int8_t | mosipin, | ||
int8_t | misopin, | ||
int8_t | sckpin | ||
) |
BMP280 constructor using bitbang SPI.
cspin | The pin to use for CS/SSEL. |
mosipin | The pin to use for MOSI. |
misopin | The pin to use for MISO. |
sckpin | The pin to use for SCK. |
bool Adafruit_BMP280::begin | ( | uint8_t | addr = BMP280_ADDRESS , |
uint8_t | chipid = BMP280_CHIPID |
||
) |
Initialises the sensor.
addr | The I2C address to use (default = 0x77) |
chipid | The expected chip ID (used to validate connection). |
uint8_t Adafruit_BMP280::getStatus | ( | void | ) |
Gets the most recent sensor event from the hardware status register.
uint8_t Adafruit_BMP280::sensorID | ( | void | ) |
Returns Sensor ID for diagnostics
float Adafruit_BMP280::readTemperature | ( | ) |
Reads the temperature from the device.
float Adafruit_BMP280::readPressure | ( | void | ) |
Reads the barometric pressure from the device.
float Adafruit_BMP280::readAltitude | ( | float | seaLevelhPa = 1013.25 | ) |
Calculates the approximate altitude using barometric pressure and the supplied sea level hPa as a reference.
seaLevelhPa | The current hPa at sea level. |
float Adafruit_BMP280::seaLevelForAltitude | ( | float | altitude, |
float | atmospheric | ||
) |
Calculates the pressure at sea level (QNH) from the specified altitude, and atmospheric pressure (QFE).
altitude | Altitude in m |
atmospheric | Atmospheric pressure in hPa |
float Adafruit_BMP280::waterBoilingPoint | ( | float | pressure | ) |
calculates the boiling point of water by a given pressure
pressure | pressure in hPa |
bool Adafruit_BMP280::takeForcedMeasurement | ( | ) |
Take a new measurement (only possible in forced mode)
Adafruit_Sensor * Adafruit_BMP280::getTemperatureSensor | ( | void | ) |
Gets an Adafruit Unified Sensor object for the temp sensor component.
Adafruit_Sensor * Adafruit_BMP280::getPressureSensor | ( | void | ) |
Gets an Adafruit Unified Sensor object for the pressure sensor component.
void Adafruit_BMP280::setSampling | ( | sensor_mode | mode = MODE_NORMAL , |
sensor_sampling | tempSampling = SAMPLING_X16 , |
||
sensor_sampling | pressSampling = SAMPLING_X16 , |
||
sensor_filter | filter = FILTER_OFF , |
||
standby_duration | duration = STANDBY_MS_1 |
||
) |
Sets the sampling config for the device.
mode | The operating mode of the sensor. |
tempSampling | The sampling scheme for temp readings. |
pressSampling | The sampling scheme for pressure readings. |
filter | The filtering mode to apply (if any). |
duration | The sampling duration. |