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

@ -53,4 +53,6 @@ int RotaryEncoder::position()
return rotaryencoder_get_position(m_rotaryencoder);
}
float RotaryEncoder::getValue() {
return (float) RotaryEncoder::position();
}

View File

@ -24,6 +24,7 @@
#pragma once
#include "rotaryencoder.h"
#include <interfaces/iRotaryAngle.hpp>
namespace upm {
@ -60,7 +61,7 @@ namespace upm {
* @snippet rotaryencoder.cxx Interesting
*/
class RotaryEncoder {
class RotaryEncoder : virtual public iRotaryAngle {
public:
/**
* RotaryEncoder constructor
@ -87,6 +88,13 @@ namespace upm {
*/
int position();
/**
* Get rotation value from sensor data.
*
* @return rotation value.
*/
virtual float getValue();
private:
/* Disable implicit copy and assignment operators */
RotaryEncoder(const RotaryEncoder&) = delete;
@ -95,5 +103,3 @@ namespace upm {
rotaryencoder_context m_rotaryencoder;
};
}