bme280.h
Go to the documentation of this file.
1 /***************************************************************************
2  This is a library for the BME280 humidity, temperature & pressure sensor
3 
4  Designed specifically to work with the Adafruit BME280 Breakout
5  ----> http://www.adafruit.com/products/2650
6 
7  These sensors use I2C or SPI to communicate, 2 or 4 pins are required
8  to interface.
9 
10  Adafruit invests time and resources providing this open source code,
11  please support Adafruit andopen-source hardware by purchasing products
12  from Adafruit!
13 
14  Written by Limor Fried & Kevin Townsend for Adafruit Industries.
15  BSD license, all text above must be included in any redistribution
16 
17  Modified by KubOS Corporation 2016 for integration into Kubos Core
18  ***************************************************************************/
46 #ifdef YOTTA_CFG_SENSORS_BME280
47 
48 #ifndef BME280_H
49 #define BME280_H
50 
51 #include <stdint.h>
52 #include "kubos-hal/spi.h"
54 
58 enum
59 {
63 
73 
80 
84 
85  /* calibration stored in 0xE1-0xF0 */
87 
94 };
95 
99 typedef struct
100 {
101  uint16_t dig_T1;
102  int16_t dig_T2;
103  int16_t dig_T3;
104 
105  uint16_t dig_P1;
106  int16_t dig_P2;
107  int16_t dig_P3;
108  int16_t dig_P4;
109  int16_t dig_P5;
110  int16_t dig_P6;
111  int16_t dig_P7;
112  int16_t dig_P8;
113  int16_t dig_P9;
114 
115  uint8_t dig_H1;
116  int16_t dig_H2;
117  uint8_t dig_H3;
118  int16_t dig_H4;
119  int16_t dig_H5;
120  int8_t dig_H6;
122 
129 
135 
143 
150 KSensorStatus bme280_read_pressure(float * press);
151 
159 
167 KSensorStatus bme280_read_altitude(float sea_level, float * alt);
168 
169 
170 #endif
171 #endif
KSensorStatus bme280_read_temperature(float *temp)
Sends temperature command and reads back temperature data.
Definition: bme280.h:66
Definition: bme280.h:64
Definition: bme280.h:89
Definition: bme280.h:77
int16_t dig_T3
Definition: bme280.h:103
KSensorStatus bme280_read_pressure(float *press)
Sends pressure command and reads back pressure data.
int16_t dig_P4
Definition: bme280.h:108
Definition: bme280.h:81
Definition: bme280.h:67
Definition: bme280.h:82
int16_t dig_P8
Definition: bme280.h:112
int16_t dig_P5
Definition: bme280.h:109
Definition: bme280.h:70
KSensorStatus bme280_soft_reset(void)
Reset the bme280 to default conditions.
Definition: bme280.h:68
KSensorStatus bme280_setup(void)
Setup the SPI interface for talking with the BME280 and init sensor.
int16_t dig_P9
Definition: bme280.h:113
Definition: bme280.h:93
KSensorStatus
Sensor status enum.
Definition: sensors.h:24
int16_t dig_P3
Definition: bme280.h:107
uint16_t dig_T1
Definition: bme280.h:101
Definition: bme280.h:62
int16_t dig_P2
Definition: bme280.h:106
Definition: bme280.h:60
int16_t dig_H5
Definition: bme280.h:119
int16_t dig_P6
Definition: bme280.h:110
KSensorStatus bme280_read_humidity(float *hum)
Sends humidity command and reads back humidity.
Definition: bme280.h:61
Definition: bme280.h:71
int16_t dig_T2
Definition: bme280.h:102
Definition: bme280.h:92
Definition: bme280.h:86
Definition: bme280.h:76
Definition: bme280.h:83
Definition: bme280.h:91
Definition: bme280.h:69
int16_t dig_P7
Definition: bme280.h:111
KSensorStatus bme280_read_altitude(float sea_level, float *alt)
converts pressure to absolute altitude
Definition: bme280.h:75
uint16_t dig_P1
Definition: bme280.h:105
Definition: bme280.h:72
int16_t dig_H4
Definition: bme280.h:118
int8_t dig_H6
Definition: bme280.h:120
uint8_t dig_H3
Definition: bme280.h:117
Definition: bme280.h:78
Definition: bme280.h:88
int16_t dig_H2
Definition: bme280.h:116
uint8_t dig_H1
Definition: bme280.h:115
Definition: bme280.h:65
Definition: bme280.h:90
calibration data structure to hold coefficients
Definition: bme280.h:99
Definition: bme280.h:79
Definition: bme280.h:74