

For Doxygen documentation click <a href="https://juraszekl.github.io/BME280_Driver/index.html" >here</a>. (only latest version)
Offline doxygen documentation for current version is attached as Doc.zip file. Unzip this file and open index.html in your browser.
Driver for Bosch BME280 Combined sensor.
This version contains abstract layer only - user must develop platform-specific driver (just three functions are needed).
Features
- Communication with I2C and SPI bus
- Read all measured values in Normal and Forced mode
- Results returned as integers or floats
- Configurable use 32-bit variables only (when 64-bit are not avalible)
- No dynamic memory allocation used
- Multithread use not supported yet
Driver is still under development, next features will be add soon. Current version - v2.0.x
Sensor description
The BME280 is a humidity sensor especially developed for mobile applications and wearables where size and low power consumption are key design parameters. The unit combines high linearity and high accuracy sensors and is perfectly feasible for low current consumption, long-term stability and high EMC robustness. The humidity sensor offers an extremely fast response time and therefore supports performance requirements for emerging applications such as context awareness, and high accuracy over a wide temperature range. BME280 Datasheet
Motivation
This project is for learning purposes only. Feel free to use it.
How to use
To use this driver perform steps listed below:
1. Clone driver into your workign directory:
git clone https://github.com/JuraszekL/BME280_Driver.git
or use as submodule if your working directory is a git repo
git submodule add https://github.com/JuraszekL/BME280_Driver.git
2. Include **__bme280.h__** file:
Header for BME280 Driver.
3. Perform configuration in **__bme280.h__** file if needed:
#define USE_64BIT
#define USE_FLOATS_RESULTS
#define USE_INTEGER_RESULTS
#define USE_GETTERS
#define USE_SETTERS
#define USE_NORMAL_MODE
#define USE_FORCED_MODE
4. Create global BME280_Driver_t structure and fill it with platform specific data:
typedef struct {
void *env_spec_data;
uint8_t i2c_address;
int8_t(* bme280_writeregister)(uint8_t reg_addr, uint8_t value, void *driver)
Definition bme280_definitions.h:184
int8_t(* bme280_readregisters)(uint8_t reg_addr, uint8_t *rxbuff, uint8_t rxlen, void *driver)
Definition bme280_definitions.h:172
void(* bme280_delayms)(uint8_t delay_time)
Definition bme280_definitions.h:190
Keeps all data specific for used platform.
Definition bme280_definitions.h:243
5. Write platform-specific functions required by driver:
Read Function:
typedef int8_t (*
bme280_readregisters)(uint8_t reg_addr, uint8_t *rxbuff, uint8_t rxlen,
void *driver);
Write Function:
Delay Function:
6. Use BME280_Init Function before any operation:
BME280_t *Dev structure is a reference for single sensor you want to work with. Should be global as well. Use pointer to this structure with any other functions from this driver.
int8_t BME280_Init(BME280_t *Dev, BME280_Driver_t *Driver)
Function to initialize sensor and resources.
Definition bme280.c:237
Keeps all data related to a single sensor.
Definition bme280_definitions.h:266
Optional steps
- Change defined types if needed:
int64_t BME280_S64_t
signed 64-bit integer variable
Definition bme280_definitions.h:202
uint32_t BME280_U32_t
unsigned 32-bit integer variable
Definition bme280_definitions.h:201
int32_t BME280_S32_t
signed 32-bit integer variable
Definition bme280_definitions.h:200
- Set all sensor's settings at once (after Init function)
int8_t BME280_ConfigureAll(BME280_t *Dev, BME280_Config_t *Config)
Function to set all sensor settings at once.
Definition bme280.c:270
Contains all sensor's settings.
Definition bme280_definitions.h:291