Updated interfaces and sensors

Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Serban Waltter
2018-07-26 18:04:31 +03:00
committed by Mihai Tudor Panu
parent bfdd2c37c0
commit 90524273ec
18 changed files with 44 additions and 63 deletions

View File

@ -74,3 +74,8 @@ float DFRPH::pH(unsigned int samples)
return ph_avg/samples;
}
float DFRPH::getPH()
{
return pH(10);
}

View File

@ -132,6 +132,13 @@ namespace upm {
*/
virtual float pH(unsigned int samples = 15);
/**
* Returns the detected pH value.
*
* @return The pH value detected
*/
virtual float getPH();
private:
/**
* Don't allow copies of this class

View File

@ -28,7 +28,6 @@
#include <string>
#include <mraa/i2c.hpp>
#include <interfaces/iClock.hpp>
#define DS1307_I2C_BUS 0
#define DS1307_I2C_ADDR 0x68
@ -70,7 +69,7 @@ namespace upm {
* @image html ds1307.jpg
* @snippet ds1307.cxx Interesting
*/
class DS1307 : virtual public iClock {
class DS1307 {
public:
/**
* DS1307 constructor
@ -84,7 +83,7 @@ namespace upm {
*
* @return True if time data loaded successfully
*/
virtual bool loadTime();
bool loadTime();
/**
* Sets the time. You should call loadTime() beforehand to
@ -92,7 +91,7 @@ namespace upm {
*
* @return True if time is set successfully
*/
virtual bool setTime();
bool setTime();
/**
* Enables an oscillator on the clock.

View File

@ -78,7 +78,7 @@ float GroveRotary::rel_rad()
return GroveRotary::rel_deg() * M_PI / 180.0;
}
float GroveRotary::getValue()
float GroveRotary::getAngle()
{
return GroveRotary::abs_value();
return GroveRotary::abs_deg();
}

View File

@ -29,7 +29,7 @@
#include <string>
#include <mraa/aio.hpp>
#include "grovebase.hpp"
#include <interfaces/iRotaryAngle.hpp>
#include <interfaces/iAngle.hpp>
namespace upm {
@ -54,7 +54,7 @@ namespace upm {
* @image html rotaryencoder.jpg
* @snippet grove-groverotary.cxx Interesting
*/
class GroveRotary: public Grove, virtual public iRotaryAngle {
class GroveRotary: public Grove, virtual public iAngle {
public:
/**
* Grove rotary angle sensor constructor
@ -108,7 +108,7 @@ class GroveRotary: public Grove, virtual public iRotaryAngle {
*
* @return rotation value.
*/
virtual float getValue();
virtual float getAngle();
private:
mraa_aio_context m_aio;

View File

@ -275,7 +275,7 @@ namespace upm {
virtual float getTemperature();
/**
* Returns the pressure in millibars
* Returns the pressure in pascal
*
* @return Pressure
*/

View File

@ -137,9 +137,9 @@ namespace upm {
/**
* Return the latest measured pressure. update() must have
* been called prior to calling this function. The returned
* value is in millibars.
* value is in pascal.
*
* @return Pressure in mbar
* @return Pressure in Pa
*/
virtual float getPressure();

View File

@ -77,7 +77,7 @@ float Rotary::rel_rad()
return Rotary::rel_deg() * M_PI / 180.0;
}
float Rotary::getValue()
float Rotary::getAngle()
{
return Rotary::abs_value();
return Rotary::abs_deg();
}

View File

@ -30,7 +30,7 @@
#include <mraa/aio.hpp>
#include "rotary.hpp"
#include <interfaces/iRotaryAngle.hpp>
#include <interfaces/iAngle.hpp>
namespace upm {
@ -60,7 +60,7 @@ namespace upm {
* @image html rotary.jpg
* @snippet rotary.cxx Interesting
*/
class Rotary : virtual public iRotaryAngle {
class Rotary : virtual public iAngle {
public:
/**
* Rotary angle sensor constructor
@ -115,7 +115,7 @@ class Rotary : virtual public iRotaryAngle {
*
* @return rotation value.
*/
virtual float getValue();
virtual float getAngle();
std::string name(){ return "Rotary Angle Sensor";}
private:

View File

@ -53,6 +53,6 @@ int RotaryEncoder::position()
return rotaryencoder_get_position(m_rotaryencoder);
}
float RotaryEncoder::getValue() {
return (float) RotaryEncoder::position();
float RotaryEncoder::getAngle() {
return (float) RotaryEncoder::position() / 20.0 * 360;
}

View File

@ -24,7 +24,7 @@
#pragma once
#include "rotaryencoder.h"
#include <interfaces/iRotaryAngle.hpp>
#include <interfaces/iAngle.hpp>
namespace upm {
@ -61,7 +61,7 @@ namespace upm {
* @snippet rotaryencoder.cxx Interesting
*/
class RotaryEncoder : virtual public iRotaryAngle {
class RotaryEncoder : virtual public iAngle {
public:
/**
* RotaryEncoder constructor
@ -93,7 +93,7 @@ namespace upm {
*
* @return rotation value.
*/
virtual float getValue();
virtual float getAngle();
private:
/* Disable implicit copy and assignment operators */