mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 17:31:13 +03:00
Added initial interfaces and some sensors implementing them
This commit is contained in:

committed by
Serban Waltter

parent
85608a9f61
commit
e7820f2831
@ -99,6 +99,12 @@ HTU21D::getTemperature(int bSampleData)
|
||||
return (float)m_temperature / 1000;
|
||||
}
|
||||
|
||||
float
|
||||
HTU21D::getTemperature()
|
||||
{
|
||||
return getTemperature(0);
|
||||
}
|
||||
|
||||
float
|
||||
HTU21D::getHumidity(int bSampleData)
|
||||
{
|
||||
@ -108,6 +114,12 @@ HTU21D::getHumidity(int bSampleData)
|
||||
return (float)m_humidity / 1000;
|
||||
}
|
||||
|
||||
float
|
||||
HTU21D::getHumidity()
|
||||
{
|
||||
return getHumidity(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Use the compensation equation from the datasheet to correct the
|
||||
* current reading
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include <string>
|
||||
#include <mraa/i2c.hpp>
|
||||
#include <math.h>
|
||||
#include <interfaces/iHumidity.hpp>
|
||||
#include <interfaces/iTemperature.hpp>
|
||||
|
||||
#define HTU21D_NAME "htu21d"
|
||||
#define HTU21D_I2C_ADDRESS 0x40
|
||||
@ -79,7 +81,7 @@ namespace upm {
|
||||
* @image html htu21d.jpeg
|
||||
* @snippet htu21d.cxx Interesting
|
||||
*/
|
||||
class HTU21D {
|
||||
class HTU21D : virtual public iHumidity, virtual public iTemperature {
|
||||
public:
|
||||
/**
|
||||
* Instantiates an HTU21D object
|
||||
@ -102,7 +104,14 @@ class HTU21D {
|
||||
* @param bSampleData Flag to sample sensor (default false)
|
||||
* @return Relative humidity in %RH
|
||||
*/
|
||||
float getHumidity(int bSampleData = false);
|
||||
float getHumidity(int bSampleData);
|
||||
|
||||
/**
|
||||
* Gets the current measured humidity [%RH]
|
||||
*
|
||||
* @return Relative humidity in %RH
|
||||
*/
|
||||
virtual float getHumidity();
|
||||
|
||||
/**
|
||||
* Gets the humidity cell temperature [degC]
|
||||
@ -110,7 +119,14 @@ class HTU21D {
|
||||
* @param bSampleData Flag to sample sensor (default false)
|
||||
* @return Temperature in degC
|
||||
*/
|
||||
float getTemperature(int bSampleData = false);
|
||||
float getTemperature(int bSampleData);
|
||||
|
||||
/**
|
||||
* Gets the humidity cell temperature [degC]
|
||||
*
|
||||
* @return Temperature in degC
|
||||
*/
|
||||
virtual float getTemperature();
|
||||
|
||||
/**
|
||||
* Using the current humidity and temperature, the function
|
||||
|
Reference in New Issue
Block a user