Added iGyroscope interface

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-10-02 14:06:17 +03:00
committed by Mihai Tudor Panu
parent 34bb12933d
commit aa966946d5
39 changed files with 222 additions and 47 deletions

View File

@ -4,7 +4,7 @@ upm_mixed_module_init (NAME bmi160
C_SRC bmi160.c bosch_bmi160.c
CPP_HDR bmi160.hpp
CPP_SRC bmi160.cxx
IFACE_HDR iAcceleration.hpp
IFACE_HDR iAcceleration.hpp iGyroscope.hpp
# FTI_SRC bmi160_fti.c
CPP_WRAPS_C
REQUIRES mraa utilities-c)

View File

@ -92,13 +92,13 @@ std::vector<float> BMI160::getAcceleration()
return v;
}
float *BMI160::getGyroscope()
std::vector<float> BMI160::getGyroscope()
{
static float values[3]; // x, y, and then z
getGyroscope(&values[0], &values[1], &values[2]);
return values;
return std::vector<float>(values, values + 3);
}
float *BMI160::getMagnetometer()

View File

@ -26,6 +26,7 @@
#include "bmi160.h"
#include <interfaces/iAcceleration.hpp>
#include <interfaces/iGyroscope.hpp>
#define BMI160_I2C_BUS 0
#define BMI160_DEFAULT_I2C_ADDR 0x69
@ -74,7 +75,7 @@ namespace upm {
*
* @snippet bmi160.cxx Interesting
*/
class BMI160: virtual public iAcceleration {
class BMI160: virtual public iAcceleration, virtual public iGyroscope {
public:
/**
@ -162,7 +163,7 @@ namespace upm {
* @return Pointer to 3 floating point values: X, Y, and Z in
* degrees per second.
*/
float *getGyroscope();
virtual std::vector<float> getGyroscope();
/**
* Get the Gyroscope values. The values returned are in degrees