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

SPI read/write functions for Bosch BME280. More...

#include "ruuvi_driver_error.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Functions

int8_t ri_spi_bme280_write (uint8_t dev_id, uint8_t reg_addr, uint8_t *p_reg_data, uint16_t len)
 SPI write function for BME280. More...
 
int8_t ri_spi_bme280_read (uint8_t dev_id, uint8_t reg_addr, uint8_t *p_reg_data, uint16_t len)
 SPI Read function for BME280. More...
 

Detailed Description

SPI read/write functions for Bosch BME280.

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

You'll need to get the official Bosch BME280 driver, available on GitHub. The wrappers will use Ruuvi Interface internally, so you don't have to port these to use BME280 on a new platform. You're required to port Yield and delay functions, GPIO functions and SPI functions.

General usage is:

static struct bme280_dev dev = {0};
dev.dev_id = bme280_cs_pin;
dev.intf = BME280_SPI_INTF;
dev.read = ri_spi_bme280_read;
dev.write = ri_spi_bme280_write;
dev.delay_ms = bosch_delay_ms;
bme280_init(&dev);
int8_t ri_spi_bme280_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len)
SPI write function for BME280.
int8_t ri_spi_bme280_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len)
SPI Read function for BME280.
void bosch_delay_ms(uint32_t time_ms)
Implement delay in Bosch signature.

Definition in file ruuvi_interface_spi_bme280.h.