mirror of
https://github.com/eclipse/upm.git
synced 2025-07-27 06:01:16 +03:00
Added initial interfaces and some sensors implementing them
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
6bf21a23e7
commit
f035470822
@ -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()
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user