bmp180.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef BMP180_H
22 #define BMP180_H
23 
24 #include "saul.h"
25 #include "periph/i2c.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
35 #define BMP180_ULTRALOWPOWER (0)
36 #define BMP180_STANDARD (1)
37 #define BMP180_HIGHRES (2)
38 #define BMP180_ULTRAHIGHRES (3)
39 
44 typedef struct {
45  int16_t ac1;
46  int16_t ac2;
47  int16_t ac3;
48  int16_t b1;
49  int16_t b2;
50  int16_t mb;
51  int16_t mc;
52  int16_t md;
53  uint16_t ac4;
54  uint16_t ac5;
55  uint16_t ac6;
57 
61 typedef struct {
64  uint8_t oversampling;
65 } bmp180_t;
66 
67 
71 typedef struct {
73  uint8_t mode;
75 
81 extern const saul_driver_t bmp180_pressure_saul_driver;
94 int bmp180_init(bmp180_t *dev, i2c_t i2c, uint8_t mode);
95 
105 int bmp180_read_temperature(bmp180_t *dev, int32_t *temperature);
106 
116 int bmp180_read_pressure(bmp180_t *dev, int32_t *pressure);
117 
128 int bmp180_altitude(bmp180_t *dev, int32_t pressure_0, int32_t *altitude);
129 
140 int bmp180_sealevel_pressure(bmp180_t *dev, int32_t altitude, int32_t *pressure_0);
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif /* BMP180_H */
147 
int bmp180_altitude(bmp180_t *dev, int32_t pressure_0, int32_t *altitude)
Compute altitude, returned in m.
int16_t md
md coefficient
Definition: bmp180.h:52
int16_t b1
b1 coefficient
Definition: bmp180.h:48
int16_t ac3
ac3 coefficient
Definition: bmp180.h:47
uint8_t oversampling
Oversampling mode.
Definition: bmp180.h:64
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:104
Definition of the RIOT actuator/sensor interface.
Definition: saul.h:140
Device initialization parameters.
Definition: bmp180.h:71
int16_t ac2
ac2 coefficient
Definition: bmp180.h:46
i2c_t i2c_dev
I2C device which is used.
Definition: bmp180.h:62
Device descriptor for the BMP180 sensor.
Definition: bmp180.h:61
Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.
uint16_t ac6
ac6 coefficient
Definition: bmp180.h:55
uint8_t mode
Oversampling mode.
Definition: bmp180.h:73
int16_t mc
mc coefficient
Definition: bmp180.h:51
bmp180_calibration_t calibration
Device calibration.
Definition: bmp180.h:63
uint16_t ac5
ac5 coefficient
Definition: bmp180.h:54
int16_t ac1
ac1 coefficient
Definition: bmp180.h:45
int bmp180_init(bmp180_t *dev, i2c_t i2c, uint8_t mode)
Initialize the given BMP180 device.
int bmp180_sealevel_pressure(bmp180_t *dev, int32_t altitude, int32_t *pressure_0)
Compute pressure at sea level, returned in Pa.
int16_t mb
mb coefficient
Definition: bmp180.h:50
int bmp180_read_temperature(bmp180_t *dev, int32_t *temperature)
Read temperature value from the given BMP180 device, returned in d°C.
const saul_driver_t bmp180_temperature_saul_driver
export SAUL endpoints
int16_t b2
b2 coefficient
Definition: bmp180.h:49
i2c_t i2c_dev
I2C device which is used.
Definition: bmp180.h:72
Calibration struct for the BMP180 sensor.
Definition: bmp180.h:44
uint16_t ac4
ac4 coefficient
Definition: bmp180.h:53
int bmp180_read_pressure(bmp180_t *dev, int32_t *pressure)
Read pressure value from the given BMP180 device, returned in Pa.
Low-level I2C peripheral driver interface definition.