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 
24 #ifndef BMP180_H
25 #define BMP180_H
26 
27 #include "saul.h"
28 #include "periph/i2c.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37 typedef enum {
38  BMP180_ULTRALOWPOWER = 0,
39  BMP180_STANDARD,
40  BMP180_HIGHRES,
41  BMP180_ULTRAHIGHRES
43 
47 typedef struct {
48  int16_t ac1;
49  int16_t ac2;
50  int16_t ac3;
51  int16_t b1;
52  int16_t b2;
53  int16_t mb;
54  int16_t mc;
55  int16_t md;
56  uint16_t ac4;
57  uint16_t ac5;
58  uint16_t ac6;
60 
64 typedef struct {
66  uint8_t i2c_addr;
69 
73 typedef struct {
76 } bmp180_t;
77 
81 enum {
82  BMP180_OK = 0,
85 };
86 
97 int bmp180_init(bmp180_t *dev, const bmp180_params_t *params);
98 
106 int16_t bmp180_read_temperature(const bmp180_t *dev);
107 
115 uint32_t bmp180_read_pressure(const bmp180_t *dev);
116 
125 int16_t bmp180_altitude(const bmp180_t *dev, uint32_t pressure_0);
126 
135 uint32_t bmp180_sealevel_pressure(const bmp180_t *dev, int16_t altitude);
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /* BMP180_H */
142 
bmp180_calibration_t::ac4
uint16_t ac4
ac4 coefficient
Definition: bmp180.h:56
bmp180_calibration_t::b2
int16_t b2
b2 coefficient
Definition: bmp180.h:52
bmp180_altitude
int16_t bmp180_altitude(const bmp180_t *dev, uint32_t pressure_0)
Compute altitude, returned in m.
bmp180_calibration_t::ac3
int16_t ac3
ac3 coefficient
Definition: bmp180.h:50
bmp180_t::calibration
bmp180_calibration_t calibration
Device calibration.
Definition: bmp180.h:75
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
bmp180_params_t::i2c_addr
uint8_t i2c_addr
I2C address.
Definition: bmp180.h:66
bmp180_calibration_t::ac6
uint16_t ac6
ac6 coefficient
Definition: bmp180.h:58
bmp180_read_temperature
int16_t bmp180_read_temperature(const bmp180_t *dev)
Read temperature value from the given BMP180 device, returned in d°C.
bmp180_params_t::oversampling
bmp180_oversampling_mode_t oversampling
Oversampling mode.
Definition: bmp180.h:67
bmp180_calibration_t::ac2
int16_t ac2
ac2 coefficient
Definition: bmp180.h:49
bmp180_read_pressure
uint32_t bmp180_read_pressure(const bmp180_t *dev)
Read pressure value from the given BMP180 device, returned in Pa.
bmp180_init
int bmp180_init(bmp180_t *dev, const bmp180_params_t *params)
Initialize the given BMP180 device.
bmp180_calibration_t::ac5
uint16_t ac5
ac5 coefficient
Definition: bmp180.h:57
BMP180_ERR_NODEV
@ BMP180_ERR_NODEV
did not detect BMP180
Definition: bmp180.h:83
bmp180_calibration_t::mc
int16_t mc
mc coefficient
Definition: bmp180.h:54
bmp180_calibration_t::ac1
int16_t ac1
ac1 coefficient
Definition: bmp180.h:48
bmp180_calibration_t
Calibration struct for the BMP180 sensor.
Definition: bmp180.h:47
bmp180_oversampling_mode_t
bmp180_oversampling_mode_t
Oversampling modes.
Definition: bmp180.h:37
bmp180_params_t
Device initialization parameters.
Definition: bmp180.h:64
bmp180_params_t::i2c_dev
i2c_t i2c_dev
I2C device which is used.
Definition: bmp180.h:65
BMP180_OK
@ BMP180_OK
everything was fine
Definition: bmp180.h:82
bmp180_calibration_t::mb
int16_t mb
mb coefficient
Definition: bmp180.h:53
saul.h
Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.
bmp180_calibration_t::b1
int16_t b1
b1 coefficient
Definition: bmp180.h:51
BMP180_ERR_NOCAL
@ BMP180_ERR_NOCAL
error when reading calibration values
Definition: bmp180.h:84
bmp180_calibration_t::md
int16_t md
md coefficient
Definition: bmp180.h:55
bmp180_sealevel_pressure
uint32_t bmp180_sealevel_pressure(const bmp180_t *dev, int16_t altitude)
Compute pressure at sea level, returned in Pa.
i2c.h
Low-level I2C peripheral driver interface definition.
bmp180_t
Device descriptor for the BMP180 sensor.
Definition: bmp180.h:73
bmp180_t::params
bmp180_params_t params
Device initialization parameters.
Definition: bmp180.h:74