Added initial interfaces and some sensors implementing them

This commit is contained in:
Mihai Stefanescu
2018-06-12 18:46:49 +03:00
committed by Serban Waltter
parent 85608a9f61
commit e7820f2831
102 changed files with 1183 additions and 182 deletions

View File

@ -207,6 +207,11 @@ MPL3115A2::getPressure(int bSampleData) {
return (float)m_iPressure / 100;
}
float
MPL3115A2::getPressure() {
return getPressure(true);
}
float
MPL3115A2::getTemperature(int bSampleData) {
int ret;

View File

@ -26,6 +26,7 @@
#include <string>
#include <mraa/i2c.hpp>
#include <math.h>
#include <interfaces/iPressure.hpp>
#define MPL3115A2_NAME "mpl3115a2"
@ -79,7 +80,7 @@ namespace upm {
* @image html mpl3115a2.jpg
* @snippet mpl3115a2.cxx Interesting
*/
class MPL3115A2 {
class MPL3115A2 : virtual public iPressure {
public:
/**
* Instantiates an MPL3115A2 object
@ -141,7 +142,14 @@ class MPL3115A2 {
*
* @param bSampleData Sets non-zero to a sample reading
*/
float getPressure(int bSampleData = true);
float getPressure(int bSampleData);
/**
* Reads the current pressure value from MPL3115A2 [Pa]
*
* @return Pressure value in Pa
*/
virtual float getPressure();
/**
* Reads the current temperature value from MPL3115A2 [degC]