ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_interface_bme280.c File Reference
#include "ruuvi_driver_enabled_modules.h"
#include "ruuvi_driver_error.h"
#include "ruuvi_driver_sensor.h"
#include "ruuvi_interface_bme280.h"
#include "ruuvi_interface_environmental.h"
#include "ruuvi_interface_gpio.h"
#include "ruuvi_interface_spi.h"
#include "ruuvi_interface_spi_bme280.h"
#include "ruuvi_interface_i2c.h"
#include "ruuvi_interface_i2c_bme280.h"
#include "ruuvi_interface_yield.h"
#include <string.h>
#include "bme280.h"
#include "bme280_defs.h"
#include "bme280_selftest.h"

Go to the source code of this file.

Macros

#define BME280_MEAS_TIME_CONST1   (1.25F)
 
#define BME280_MEAS_TIME_CONST2   (2.3F)
 
#define BME280_MEAS_TIME_CONST3   (3.0F)
 
#define BME280_MEAS_TIME_CONST4   (2.0F)
 
#define BME280_MEAS_TIME_CONST5   (0.575F)
 
#define BME280_MEAS_TIME_CONST6   (2U)
 
#define BME280_SAMPLERATE_1000MS   (1U)
 
#define BME280_SAMPLERATE_500MS   (2U)
 
#define BME280_SAMPLERATE_125MS   (8U)
 
#define BME280_SAMPLERATE_62_5MS   (16U)
 
#define BME280_SAMPLERATE_20MS   (50U)
 
#define BME280_SAMPLERATE_10MS   (100U)
 
#define BME280_SAMPLERATE_0_5MS   (200U)
 
#define BME280_DSP_MODE_0   (1U)
 
#define BME280_DSP_MODE_1   (2U)
 
#define BME280_DSP_MODE_2   (4U)
 
#define BME280_DSP_MODE_3   (8U)
 
#define BME280_DSP_MODE_4   (16U)
 
#define BME280_HUMIDITY   (0)
 
#define BME280_PRESSURE   (1)
 
#define BME280_TEMPERATURE   (2)
 
#define BME280_SENS_NUM   (3)
 
#define BME280_HUMIDITY_MAX_VALUE   (100.0f)
 

Typedefs

typedef float bme_float
 

Functions

void bosch_delay_ms (uint32_t time_ms)
 Implement delay in Bosch signature. More...
 
rd_status_t ri_bme280_init (rd_sensor_t *p_sensor, rd_bus_t bus, uint8_t handle)
 rd_sensor_init_fp More...
 
rd_status_t ri_bme280_uninit (rd_sensor_t *sensor, rd_bus_t bus, uint8_t handle)
 rd_sensor_init_fp More...
 
rd_status_t ri_bme280_samplerate_set (uint8_t *samplerate)
 rd_sensor_setup_fp More...
 
rd_status_t ri_bme280_samplerate_get (uint8_t *samplerate)
 rd_sensor_setup_fp More...
 
rd_status_t ri_bme280_resolution_set (uint8_t *resolution)
 rd_sensor_setup_fp More...
 
rd_status_t ri_bme280_resolution_get (uint8_t *resolution)
 rd_sensor_setup_fp More...
 
rd_status_t ri_bme280_scale_set (uint8_t *scale)
 rd_sensor_setup_fp More...
 
rd_status_t ri_bme280_scale_get (uint8_t *scale)
 rd_sensor_setup_fp More...
 
rd_status_t ri_bme280_dsp_set (uint8_t *dsp, uint8_t *parameter)
 rd_sensor_dsp_fp More...
 
rd_status_t ri_bme280_dsp_get (uint8_t *dsp, uint8_t *parameter)
 rd_sensor_dsp_fp More...
 
rd_status_t ri_bme280_mode_set (uint8_t *mode)
 rd_sensor_setup_fp More...
 
rd_status_t ri_bme280_mode_get (uint8_t *mode)
 rd_sensor_setup_fp More...
 
rd_status_t ri_bme280_data_get (rd_sensor_data_t *const p_data)
 rd_sensor_data_fp More...
 

Detailed Description

Author
Otso Jousimaa otso@.nosp@m.ojou.nosp@m.sima..nosp@m.net
Date
2020-04-28

Requires Bosch BME280_driver, available under BSD-3 on GitHub. Will only get compiled if RI_BME280_ENABLED is defined as true Requires BME280_FLOAT_ENABLE defined in makefile or otherwise passed to preprocessor

Definition in file ruuvi_interface_bme280.c.

Macro Definition Documentation

◆ BME280_DSP_MODE_0

#define BME280_DSP_MODE_0   (1U)

Definition at line 55 of file ruuvi_interface_bme280.c.

◆ BME280_DSP_MODE_1

#define BME280_DSP_MODE_1   (2U)

Definition at line 56 of file ruuvi_interface_bme280.c.

◆ BME280_DSP_MODE_2

#define BME280_DSP_MODE_2   (4U)

Definition at line 57 of file ruuvi_interface_bme280.c.

◆ BME280_DSP_MODE_3

#define BME280_DSP_MODE_3   (8U)

Definition at line 58 of file ruuvi_interface_bme280.c.

◆ BME280_DSP_MODE_4

#define BME280_DSP_MODE_4   (16U)

Definition at line 59 of file ruuvi_interface_bme280.c.

◆ BME280_HUMIDITY

#define BME280_HUMIDITY   (0)

Definition at line 61 of file ruuvi_interface_bme280.c.

◆ BME280_HUMIDITY_MAX_VALUE

#define BME280_HUMIDITY_MAX_VALUE   (100.0f)

Definition at line 66 of file ruuvi_interface_bme280.c.

◆ BME280_MEAS_TIME_CONST1

#define BME280_MEAS_TIME_CONST1   (1.25F)

Definition at line 40 of file ruuvi_interface_bme280.c.

◆ BME280_MEAS_TIME_CONST2

#define BME280_MEAS_TIME_CONST2   (2.3F)

Definition at line 41 of file ruuvi_interface_bme280.c.

◆ BME280_MEAS_TIME_CONST3

#define BME280_MEAS_TIME_CONST3   (3.0F)

Definition at line 42 of file ruuvi_interface_bme280.c.

◆ BME280_MEAS_TIME_CONST4

#define BME280_MEAS_TIME_CONST4   (2.0F)

Definition at line 43 of file ruuvi_interface_bme280.c.

◆ BME280_MEAS_TIME_CONST5

#define BME280_MEAS_TIME_CONST5   (0.575F)

Definition at line 44 of file ruuvi_interface_bme280.c.

◆ BME280_MEAS_TIME_CONST6

#define BME280_MEAS_TIME_CONST6   (2U)

Definition at line 45 of file ruuvi_interface_bme280.c.

◆ BME280_PRESSURE

#define BME280_PRESSURE   (1)

Definition at line 62 of file ruuvi_interface_bme280.c.

◆ BME280_SAMPLERATE_0_5MS

#define BME280_SAMPLERATE_0_5MS   (200U)

Definition at line 53 of file ruuvi_interface_bme280.c.

◆ BME280_SAMPLERATE_1000MS

#define BME280_SAMPLERATE_1000MS   (1U)

Definition at line 47 of file ruuvi_interface_bme280.c.

◆ BME280_SAMPLERATE_10MS

#define BME280_SAMPLERATE_10MS   (100U)

Definition at line 52 of file ruuvi_interface_bme280.c.

◆ BME280_SAMPLERATE_125MS

#define BME280_SAMPLERATE_125MS   (8U)

Definition at line 49 of file ruuvi_interface_bme280.c.

◆ BME280_SAMPLERATE_20MS

#define BME280_SAMPLERATE_20MS   (50U)

Definition at line 51 of file ruuvi_interface_bme280.c.

◆ BME280_SAMPLERATE_500MS

#define BME280_SAMPLERATE_500MS   (2U)

Definition at line 48 of file ruuvi_interface_bme280.c.

◆ BME280_SAMPLERATE_62_5MS

#define BME280_SAMPLERATE_62_5MS   (16U)

Definition at line 50 of file ruuvi_interface_bme280.c.

◆ BME280_SENS_NUM

#define BME280_SENS_NUM   (3)

Definition at line 64 of file ruuvi_interface_bme280.c.

◆ BME280_TEMPERATURE

#define BME280_TEMPERATURE   (2)

Definition at line 63 of file ruuvi_interface_bme280.c.

Typedef Documentation

◆ bme_float

typedef float bme_float

Definition at line 68 of file ruuvi_interface_bme280.c.

Function Documentation

◆ bosch_delay_ms()

void bosch_delay_ms ( uint32_t  time_ms)

Implement delay in Bosch signature.

Parameters
[in]time_mstime to delay

Definition at line 128 of file ruuvi_interface_bme280.c.

◆ ri_bme280_data_get()

rd_status_t ri_bme280_data_get ( rd_sensor_data_t *const  p_data)

rd_sensor_data_fp

Definition at line 853 of file ruuvi_interface_bme280.c.

◆ ri_bme280_dsp_get()

rd_status_t ri_bme280_dsp_get ( uint8_t *  dsp,
uint8_t *  parameter 
)

rd_sensor_dsp_fp

Definition at line 724 of file ruuvi_interface_bme280.c.

◆ ri_bme280_dsp_set()

rd_status_t ri_bme280_dsp_set ( uint8_t *  dsp,
uint8_t *  parameter 
)

rd_sensor_dsp_fp

Definition at line 600 of file ruuvi_interface_bme280.c.

◆ ri_bme280_init()

rd_status_t ri_bme280_init ( rd_sensor_t p_sensor,
rd_bus_t  bus,
uint8_t  handle 
)

rd_sensor_init_fp

Initialize BME280 into low-power mode

Definition at line 209 of file ruuvi_interface_bme280.c.

◆ ri_bme280_mode_get()

rd_status_t ri_bme280_mode_get ( uint8_t *  mode)

rd_sensor_setup_fp

Definition at line 806 of file ruuvi_interface_bme280.c.

◆ ri_bme280_mode_set()

rd_status_t ri_bme280_mode_set ( uint8_t *  mode)

rd_sensor_setup_fp

Definition at line 773 of file ruuvi_interface_bme280.c.

◆ ri_bme280_resolution_get()

rd_status_t ri_bme280_resolution_get ( uint8_t *  resolution)

rd_sensor_setup_fp

Definition at line 418 of file ruuvi_interface_bme280.c.

◆ ri_bme280_resolution_set()

rd_status_t ri_bme280_resolution_set ( uint8_t *  resolution)

rd_sensor_setup_fp

Definition at line 390 of file ruuvi_interface_bme280.c.

◆ ri_bme280_samplerate_get()

rd_status_t ri_bme280_samplerate_get ( uint8_t *  samplerate)

rd_sensor_setup_fp

Definition at line 338 of file ruuvi_interface_bme280.c.

◆ ri_bme280_samplerate_set()

rd_status_t ri_bme280_samplerate_set ( uint8_t *  samplerate)

rd_sensor_setup_fp

Definition at line 312 of file ruuvi_interface_bme280.c.

◆ ri_bme280_scale_get()

rd_status_t ri_bme280_scale_get ( uint8_t *  scale)

rd_sensor_setup_fp

Definition at line 462 of file ruuvi_interface_bme280.c.

◆ ri_bme280_scale_set()

rd_status_t ri_bme280_scale_set ( uint8_t *  scale)

rd_sensor_setup_fp

Definition at line 434 of file ruuvi_interface_bme280.c.

◆ ri_bme280_uninit()

rd_status_t ri_bme280_uninit ( rd_sensor_t sensor,
rd_bus_t  bus,
uint8_t  handle 
)

rd_sensor_init_fp

Definition at line 257 of file ruuvi_interface_bme280.c.