bme280.h File Reference

Device driver interface for the BME280 sensor. More...

Detailed Description

There are three sensor values that can be read: temperature, pressure and humidity. The BME280 device usually measures them all at once. It is possible to skip measuring either of the values by changing the oversampling settings. The driver is written in such a way that a measurement is only started from the function that reads the temperature. In other words, you always have to call bme280_read_temperature, and then optionally you can call the other two.

Author
Kees Bakker kees@.nosp@m.soda.nosp@m.q.com

Definition in file bme280.h.

#include "saul.h"
#include "periph/i2c.h"
+ Include dependency graph for bme280.h:

Go to the source code of this file.

Data Structures

struct  bme280_calibration_t
 Calibration struct for the BME280 sensor. More...
 
struct  bme280_params_t
 Parameters for the BME280 sensor. More...
 
struct  bme280_t
 Device descriptor for the BME280 sensor. More...
 

Enumerations

enum  bme280_t_sb_t {
  BME280_SB_0_5 = 0, BME280_SB_62_5 = 1, BME280_SB_125 = 2, BME280_SB_250 = 3,
  BME280_SB_500 = 4, BME280_SB_1000 = 5, BME280_SB_10 = 6, BME280_SB_20 = 7
}
 Values for t_sb field of the BME280 config register.
 
enum  bme280_filter_t {
  BME280_FILTER_OFF = 0, BME280_FILTER_2 = 1, BME280_FILTER_4 = 2, BME280_FILTER_8 = 3,
  BME280_FILTER_16 = 4
}
 Values for filter field of the BME280 config register.
 
enum  bme280_mode_t { BME280_MODE_SLEEP = 0, BME280_MODE_FORCED = 1, BME280_MODE_FORCED2 = 2, BME280_MODE_NORMAL = 3 }
 Values for mode field of the BME280 ctrl_meas register.
 
enum  bme280_osrs_t {
  BME280_OSRS_SKIPPED = 0, BME280_OSRS_X1 = 1, BME280_OSRS_X2 = 2, BME280_OSRS_X4 = 3,
  BME280_OSRS_X8 = 4, BME280_OSRS_X16 = 5
}
 Values for oversampling settings. More...
 
enum  { BME280_OK = 0, BME280_ERR_I2C = -1, BME280_ERR_NODEV = -2, BME280_ERR_NOCAL = -3 }
 Status and error return codes. More...
 

Functions

int bme280_init (bme280_t *dev, const bme280_params_t *params)
 Initialize the given BME280 device. More...
 
int16_t bme280_read_temperature (bme280_t *dev)
 Read temperature value from the given BME280 device, returned in centi °C. More...
 
uint16_t bme280_read_humidity (bme280_t *dev)
 Read humidity value from the given BME280 device, returned in centi RH. More...
 
uint32_t bme280_read_pressure (bme280_t *dev)
 Read air pressure value from the given BME280 device, returned in PA. More...
 

Variables

const saul_driver_t bme280_temperature_saul_driver
 export SAUL endpoints
 
const saul_driver_t bme280_relative_humidity_saul_driver
 
const saul_driver_t bme280_pressure_saul_driver