Added interface iRotaryAngle

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Stefan Andritoiu
2018-06-20 18:27:59 +03:00
committed by Mihai Tudor Panu
parent 75c7bd8d12
commit 8693a72ed6
8 changed files with 92 additions and 6 deletions

View File

@ -76,3 +76,8 @@ float Rotary::rel_rad()
{
return Rotary::rel_deg() * M_PI / 180.0;
}
float Rotary::getValue()
{
return Rotary::abs_value();
}

View File

@ -30,6 +30,7 @@
#include <mraa/aio.hpp>
#include "rotary.hpp"
#include <interfaces/iRotaryAngle.hpp>
namespace upm {
@ -59,7 +60,7 @@ namespace upm {
* @image html rotary.jpg
* @snippet rotary.cxx Interesting
*/
class Rotary{
class Rotary : virtual public iRotaryAngle {
public:
/**
* Rotary angle sensor constructor
@ -77,6 +78,7 @@ class Rotary{
* @return Unsigned value from the ADC
*/
float abs_value();
/**
* Gets absolute raw degrees from the AIO pin
*
@ -107,6 +109,14 @@ class Rotary{
* @return Signed radians from the ADC
*/
float rel_rad();
/**
* Get rotation value as raw degrees from the AIO pin.
*
* @return rotation value.
*/
virtual float getValue();
std::string name(){ return "Rotary Angle Sensor";}
private:
mraa_aio_context m_aio;