Device driver interface for the Bosch BMP280 and BME280 sensors. More...
Device driver interface for the Bosch BMP280 and BME280 sensors.
BMP280 and BME280 measure temperature in centi °C and pressure in Pa. BME280 can also measure relative humidity in %.
For more information, see the datasheets:
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
To include this driver to your application, simply add one of the following to the application's Makefile:
This way the default parameters in drivers/bmx280/include/bmx280_params.h
are replaced by these new values.
Files | |
file | bmx280_internals.h |
Internal addresses, registers, constants for the BMX280 family sensors. | |
file | bmx280_params.h |
Default configuration for BMX280. | |
file | bmx280.h |
Device driver interface for the BMP280 and BME280 sensors. | |
Data Structures | |
struct | bmx280_calibration_t |
Calibration struct for the BMX280 sensor. More... | |
struct | bmx280_params_t |
Parameters for the BMX280 sensor. More... | |
struct | bmx280_t |
Device descriptor for the BMX280 sensor. More... | |
Macros | |
#define | BMX280_RAW_LEN (6U) |
Select the number or raw data bytes depending on the device type. | |
Enumerations | |
enum | bmx280_t_sb_t { BMX280_SB_0_5 = 0x00, BMX280_SB_62_5 = 0x20, BMX280_SB_125 = 0x40, BMX280_SB_250 = 0x60, BMX280_SB_500 = 0x80, BMX280_SB_1000 = 0xa0, BMX280_SB_10 = 0xc0, BMX280_SB_20 = 0xe0 } |
Values for t_sb field of the BMX280 config register. | |
enum | bmx280_filter_t { BMX280_FILTER_OFF = 0x00, BMX280_FILTER_2 = 0x04, BMX280_FILTER_4 = 0x08, BMX280_FILTER_8 = 0x0c, BMX280_FILTER_16 = 0x10 } |
Values for filter field of the BMX280 config register. | |
enum | bmx280_mode_t { BMX280_MODE_SLEEP = 0x00, BMX280_MODE_FORCED = 0x01, BMX280_MODE_NORMAL = 0x03 } |
Values for mode field of the BMX280 ctrl_meas register. | |
enum | bmx280_osrs_t { BMX280_OSRS_SKIPPED = 0x00, BMX280_OSRS_X1 = 0x01, BMX280_OSRS_X2 = 0x02, BMX280_OSRS_X4 = 0x03, BMX280_OSRS_X8 = 0x04, BMX280_OSRS_X16 = 0x05 } |
Values for oversampling settings. More... | |
enum | { BMX280_OK = 0, BMX280_ERR_BUS = -1, BMX280_ERR_NODEV = -2 } |
Status and error return codes. More... | |
Functions | |
int | bmx280_init (bmx280_t *dev, const bmx280_params_t *params) |
Initialize the given BMX280 device. More... | |
int16_t | bmx280_read_temperature (bmx280_t *dev) |
Read temperature value from the given BMX280 device. More... | |
uint32_t | bmx280_read_pressure (bmx280_t *dev) |
Read air pressure value from the given BMX280 device. More... | |
uint16_t | bme280_read_humidity (bmx280_t *dev) |
Read humidity value from the given BME280 device. More... | |
Variables | |
const saul_driver_t | bmx280_temperature_saul_driver |
Export of SAUL interface for temperature sensor. | |
const saul_driver_t | bmx280_pressure_saul_driver |
Export of SAUL interface for pressure sensor. | |
anonymous enum |
enum bmx280_osrs_t |
uint16_t bme280_read_humidity | ( | bmx280_t * | dev | ) |
Read humidity value from the given BME280 device.
The humidity is returned in centi RH (x.xx% relative humidity).
This function returns the pressure data that was measured when bmx280_read_temperature() has been called last. So bmx280_read_temperature() has to be called before.
If bmx280_read_temperatue() did not succeed in acquiring a new set of sensor data, the result of this function is undefined.
[in] | dev | device to read from |
int bmx280_init | ( | bmx280_t * | dev, |
const bmx280_params_t * | params | ||
) |
Initialize the given BMX280 device.
[out] | dev | device descriptor of the given BMX280 device |
[in] | params | static configuration parameters |
uint32_t bmx280_read_pressure | ( | bmx280_t * | dev | ) |
Read air pressure value from the given BMX280 device.
The air pressure is returned in PA (Pascal).
This function returns the pressure data that was measured when bmx280_read_temperature() has been called last. So bmx280_read_temperature() has to be called before.
If bmx280_read_temperatue() did not succeed in acquiring a new set of sensor data, the result of this function is undefined.
[in] | dev | device to read from |
int16_t bmx280_read_temperature | ( | bmx280_t * | dev | ) |
Read temperature value from the given BMX280 device.
The measured temperature is returned in centi °C (x.xx°C).
[in] | dev | device to read from |