upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
bme280.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016-2017 Intel Corporation.
4  *
5  * The MIT License
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  */
26 #pragma once
27 
28 #include <string>
29 #include "interfaces/iHumiditySensor.hpp"
30 
31 #include "bmp280.hpp"
32 
33 namespace upm {
34 
60  class BME280 : public BMP280, public IHumiditySensor {
61  public:
62 
83  BME280(int bus=BME280_DEFAULT_I2C_BUS, int addr=BME280_DEFAULT_ADDR,
84  int cs=-1);
85 
89  virtual ~BME280();
90 
99  float getHumidity();
100 
109  void setOversampleRateHumidity(BME280_OSRS_H_T rate);
110 
111  // Interface support
112  const char *getModuleName()
113  {
114  return "BME280";
115  };
116 
117  int getHumidityRelative()
118  {
119  return int(getHumidity());
120  };
121 
122  protected:
123 
124  private:
125  };
126 }
void setOversampleRateHumidity(BME280_OSRS_H_T rate)
Definition: bme280.cxx:53
const char * getModuleName()
Definition: bme280.hpp:112
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
float getHumidity()
Definition: bme280.cxx:48
API for the BME280 Digital Humidity, Pressure, and Temperature Sensor.
Definition: bme280.hpp:60
BME280(int bus=BME280_DEFAULT_I2C_BUS, int addr=BME280_DEFAULT_ADDR, int cs=-1)
Definition: bme280.cxx:39
virtual ~BME280()
Definition: bme280.cxx:44
API for the BMP280 Digital Pressure Sensor.
Definition: bmp280.hpp:70
Interface for Humidity Sensors.
Definition: iHumiditySensor.hpp:34