Added initial interfaces and some sensors implementing them

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Mihai Stefanescu
2018-06-12 18:46:49 +03:00
committed by Mihai Tudor Panu
parent 6bf21a23e7
commit f035470822
102 changed files with 1183 additions and 182 deletions

View File

@ -125,6 +125,12 @@ HDC1000::getTemperature(int bSampleData)
return (float)(m_temperature * 0.01);
}
float
HDC1000::getTemperature()
{
return getTemperature(false);
}
float
HDC1000::getHumidity(int bSampleData)
{
@ -133,3 +139,9 @@ HDC1000::getHumidity(int bSampleData)
}
return (float)(m_humidity * 0.01);
}
float
HDC1000::getHumidity()
{
return getHumidity(false);
}

View File

@ -29,6 +29,8 @@
#include <string>
#include <mraa/i2c.hpp>
#include <math.h>
#include <interfaces/iHumidity.hpp>
#include <interfaces/iTemperature.hpp>
#define HDC1000_NAME "hdc1000"
#define HDC1000_i2C_ADDRESS 0x43
@ -87,7 +89,7 @@ namespace upm {
*
* @snippet hdc1000.cxx Interesting
*/
class HDC1000 {
class HDC1000 : virtual public iHumidity, virtual public iTemperature {
public:
/**
* Instantiates an HDC1000 object
@ -123,7 +125,14 @@ class HDC1000 {
* @param bSampleData Flag to read sensor
* @return The humidity sensor temp in degC
*/
float getHumidity(int bSampleData = false);
float getHumidity(int bSampleData);
/**
* Get the current measured humidity [RH]
*
* @return The humidity sensor temp in degC
*/
virtual float getHumidity();
/**
* Get the humidity cell temperature [degC]
@ -131,7 +140,14 @@ class HDC1000 {
* @param bSampleData Flag to read sensor
* @return The humidity sensor temp in degC
*/
float getTemperature(int bSampleData = false);
float getTemperature(int bSampleData);
/**
* Get the humidity cell temperature [degC]
*
* @return The humidity sensor temp in degC
*/
virtual float getTemperature();
private: