ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_interface_bme280.h File Reference

Go to the source code of this file.

Macros

#define BME280_HUMIDITY_OFFSET   (-3.0f)
 Generally, BMEs show 3% too little. Compensate. More...
 

Functions

void bosch_delay_ms (uint32_t time_ms)
 Implement delay in Bosch signature. More...
 
rd_status_t ri_bme280_init (rd_sensor_t *environmental_sensor, rd_bus_t bus, uint8_t handle)
 rd_sensor_init_fp More...
 
rd_status_t ri_bme280_uninit (rd_sensor_t *environmental_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 data)
 rd_sensor_data_fp More...
 

Detailed Description

Author
Otso Jousimaa otso@.nosp@m.ojou.nosp@m.sima..nosp@m.net
Date
2020-11-05

Interface for BME280 basic usage. The underlying platform must provide functions for SPI and/or I2C access, ruuvi_interface_spi_bme280.h and ruuvi_interface_i2c_bme280.h.

Testing the interface with ruuvi_driver_sensor_test.h

uint8_t handle = 0;
bus = RD_BUS_SPI;
handle = RUUVI_BOARD_SPI_SS_ENVIRONMENTAL_PIN;
err_code = test_sensor_init(init, bus, handle);
err_code = test_sensor_setup(init, bus, handle);
err_code = test_sensor_modes(init, bus, handle);
uint32_t rd_status_t
bitfield for representing errors
#define RD_ERROR_CHECK(error, mask)
Shorthand macro for calling the rd_error_check with current file & line.
#define RD_SUCCESS
Internal Error.
#define RD_ERROR_SELFTEST
Self-test fail.
rd_status_t(* rd_sensor_init_fp)(rd_sensor_t *const p_sensor, const rd_bus_t bus, const uint8_t handle)
Initialize and uninitialize sensor. Init and uninit will setup sensor with function pointers....
rd_bus_t
Type of bus sensor uses.
@ RD_BUS_SPI
SPI bus.
@ RD_BUS_NONE
No bus, internal to IC.
rd_status_t ri_bme280_init(rd_sensor_t *p_sensor, rd_bus_t bus, uint8_t handle)
rd_sensor_init_fp

Definition in file ruuvi_interface_bme280.h.

Macro Definition Documentation

◆ BME280_HUMIDITY_OFFSET

#define BME280_HUMIDITY_OFFSET   (-3.0f)

Generally, BMEs show 3% too little. Compensate.

Definition at line 49 of file ruuvi_interface_bme280.h.

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  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 environmental_sensor,
rd_bus_t  bus,
uint8_t  handle 
)

rd_sensor_init_fp

Definition at line 257 of file ruuvi_interface_bme280.c.