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

@ -62,6 +62,11 @@ int Temperature::value ()
return (int) round(t);
}
float Temperature::getTemperature ()
{
return value();
}
float Temperature::raw_value()
{
return (float) mraa_aio_read(m_aio);

View File

@ -28,6 +28,7 @@
#include <string>
#include <mraa/aio.hpp>
#include <interfaces/iTemperature.hpp>
namespace upm {
/**
@ -58,7 +59,7 @@ namespace upm {
* @image html temp.jpg
* @snippet temperature.cxx Interesting
*/
class Temperature {
class Temperature : virtual public iTemperature {
public:
/**
* Analog temperature sensor constructor
@ -96,6 +97,13 @@ class Temperature {
* @return Normalized temperature in Celsius
*/
int value();
/**
* Gets the temperature in Celsius from the sensor
*
* @return Normalized temperature in Celsius
*/
virtual float getTemperature();
private:
mraa_aio_context m_aio;
float m_scale;