AskSin++
Bmp180.h
1 //- -----------------------------------------------------------------------------------------------------------------------
2 // AskSin++
3 // 2018-04-03 papa Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
4 //- -----------------------------------------------------------------------------------------------------------------------
5 
6 #ifndef __SENSORS_BMP180_h__
7 #define __SENSORS_BMP180_h__
8 
9 #include <Sensors.h>
10 #include <Wire.h>
11 #include <Adafruit_BMP085.h>
12 
13 namespace as {
14 
15 // https://github.com/adafruit/Adafruit-BMP085-Library
16 class Bmp180 : public Temperature, public Pressure {
17  Adafruit_BMP085 _bmp;
18 public:
19  Bmp180 () {}
20  void init () {
21  _present = _bmp.begin();
22  }
23  void measure (__attribute__((unused)) bool async=false) {
24  if( present() == true ) {
25  _temperature = _bmp.readTemperature() * 10;
26  _pressure = _bmp.readPressure() / 100;
27  }
28  }
29 };
30 
31 }
32 
33 #endif
as::Bmp180
Definition: Bmp180.h:16
as::Temperature
Definition: Sensors.h:30
as::Pressure
Definition: Sensors.h:48