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

@ -190,7 +190,8 @@ float HP20X::getPressure()
// now read the pressure
writeCmd(CMD_READ_P);
return ((float)readData() / 100.0);
// Return result in Pa, not milibars.
return (float)readData();
}
float HP20X::getAltitude()

View File

@ -26,6 +26,8 @@
#include <string>
#include <mraa/common.hpp>
#include <mraa/i2c.hpp>
#include <interfaces/iPressure.hpp>
#include <interfaces/iTemperature.hpp>
#define HP20X_I2C_BUS 0
#define HP20X_DEFAULT_I2C_ADDR 0x76
@ -61,7 +63,7 @@ namespace upm {
* @image html hp20x.jpg
* @snippet hp20x.cxx Interesting
*/
class HP20X {
class HP20X : virtual public iPressure, virtual public iTemperature {
public:
/**
@ -270,14 +272,14 @@ namespace upm {
*
* @return Temperature
*/
float getTemperature();
virtual float getTemperature();
/**
* Returns the pressure in millibars
*
* @return Pressure
*/
float getPressure();
virtual float getPressure();
/**
* Returns the computed altitude in meters