Skyward boardcore
|
#include <BME280.h>
Classes | |
union | BME280Comp |
union | BME280Config |
Public Types | |
enum | Oversampling { SKIPPED = 0x0 , OVERSAMPLING_1 = 0x1 , OVERSAMPLING_2 = 0x2 , OVERSAMPLING_4 = 0x3 , OVERSAMPLING_8 = 0x4 , OVERSAMPLING_16 = 0x5 } |
enum | Mode { SLEEP_MODE = 0x0 , FORCED_MODE = 0x1 , NORMAL_MODE = 0x3 } |
enum | StandbyTime { STB_TIME_0_5 = 0x0 , STB_TIME_62_5 = 0x1 , STB_TIME_125 = 0x2 , STB_TIME_250 = 0x3 , STB_TIME_500 = 0x4 , STB_TIME_1000 = 0x5 , STB_TIME_10 = 0x6 , STB_TIME_20 = 0x7 } |
enum | FilterCoeff { FILTER_OFF = 0x0 , FILTER_COEFF_2 = 0x1 , FILTER_COEFF_4 = 0x2 , FILTER_COEFF_8 = 0x3 , FILTER_COEFF_16 = 0x4 } |
![]() | |
using | DataType |
Public Member Functions | |
BME280 (SPISlave spiSlave, BME280Config config=BME280_CONFIG_ALL_ENABLED) | |
bool | init () override |
Initialize the device with the specified configuration. | |
void | setSensorMode (Mode mode) |
Sets the sensor mode. | |
void | setHumidityOversampling (Oversampling oversampling) |
Sets the oversampling for humidity readings, use SKIPPED to disable humidity sampling. | |
void | setPressureOversampling (Oversampling oversampling) |
Sets the oversampling for pressure readings, use SKIPPED to disable pressure sampling. | |
void | setTemperatureOversampling (Oversampling oversampling) |
Sets the oversampling for temperature readings, use SKIPPED to disable temperature sampling. | |
void | setFilterCoeff (FilterCoeff filterCoeff) |
Sets the coefficient for the IIR filter (applied to temperature and pressure) | |
void | setStandbyTime (StandbyTime standbyTime) |
Sets the standby time between readings in normal mode. | |
HumidityData | readHumidity () |
Reads only the humidity, does not set the configuration. | |
PressureData | readPressure () |
Reads only the pressure, does not set the configuration. | |
TemperatureData | readTemperature () |
Reads only the temperature, does not set the configuration. | |
unsigned int | getMaxMeasurementTime () |
bool | selfTest () override |
Reads the WHO AM I register. | |
![]() | |
Sensor () | |
Sensor (Sensor &&other) | |
virtual | ~Sensor () |
void | sample () override |
Sample the sensor. | |
virtual BME280Data | getLastSample () |
![]() | |
virtual | ~AbstractSensor () |
SensorErrors | getLastError () |
Get last error for debugging purposes. Avoid silent fails. | |
Static Public Member Functions | |
static unsigned int | calculateMaxMeasurementTime (BME280Config config) |
Maximum measurement time formula from datasheet page 51. | |
Static Public Attributes | |
static constexpr uint8_t | REG_ID_VAL = 0x60 |
Who am I value. | |
static const BME280Config | BME280_DEFAULT_CONFIG |
Datasheet values for indoor navigation. | |
static const BME280Config | BME280_CONFIG_ALL_ENABLED |
Temperature enabled in forced mode. | |
static const BME280Config | BME280_CONFIG_TEMP_SINGLE |
Protected Member Functions | |
BME280Data | sampleImpl () override |
Read a data sample from the sensor. In case of errors, the method should return the last available correct sample. | |
Additional Inherited Members | |
![]() | |
DataType | lastSample |
miosix::FastMutex | mutex |
![]() | |
SensorErrors | lastError = SensorErrors::NO_ERRORS |
|
explicit |
Definition at line 50 of file BME280.cpp.
|
static |
Maximum measurement time formula from datasheet page 51.
Definition at line 202 of file BME280.cpp.
unsigned int Boardcore::BME280::getMaxMeasurementTime | ( | ) |
Definition at line 209 of file BME280.cpp.
|
overridevirtual |
Initialize the device with the specified configuration.
Implements Boardcore::AbstractSensor.
Definition at line 55 of file BME280.cpp.
HumidityData Boardcore::BME280::readHumidity | ( | ) |
Reads only the humidity, does not set the configuration.
Definition at line 138 of file BME280.cpp.
PressureData Boardcore::BME280::readPressure | ( | ) |
Reads only the pressure, does not set the configuration.
Definition at line 158 of file BME280.cpp.
TemperatureData Boardcore::BME280::readTemperature | ( | ) |
Reads only the temperature, does not set the configuration.
Definition at line 179 of file BME280.cpp.
|
overrideprotectedvirtual |
Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.
Implements Boardcore::Sensor< BME280Data >.
Definition at line 216 of file BME280.cpp.
|
overridevirtual |
Reads the WHO AM I register.
Implements Boardcore::AbstractSensor.
Definition at line 214 of file BME280.cpp.
void Boardcore::BME280::setFilterCoeff | ( | FilterCoeff | filterCoeff | ) |
Sets the coefficient for the IIR filter (applied to temperature and pressure)
Definition at line 124 of file BME280.cpp.
void Boardcore::BME280::setHumidityOversampling | ( | Oversampling | oversampling | ) |
Sets the oversampling for humidity readings, use SKIPPED to disable humidity sampling.
Definition at line 103 of file BME280.cpp.
void Boardcore::BME280::setPressureOversampling | ( | Oversampling | oversampling | ) |
Sets the oversampling for pressure readings, use SKIPPED to disable pressure sampling.
Definition at line 110 of file BME280.cpp.
void Boardcore::BME280::setSensorMode | ( | Mode | mode | ) |
Sets the sensor mode.
Values:
Definition at line 96 of file BME280.cpp.
void Boardcore::BME280::setStandbyTime | ( | StandbyTime | standbyTime | ) |
Sets the standby time between readings in normal mode.
Definition at line 131 of file BME280.cpp.
void Boardcore::BME280::setTemperatureOversampling | ( | Oversampling | oversampling | ) |
Sets the oversampling for temperature readings, use SKIPPED to disable temperature sampling.
Definition at line 117 of file BME280.cpp.
|
static |
Temperature enabled in forced mode.
|
static |
|
static |
Datasheet values for indoor navigation.
|
staticconstexpr |