Initial implementation of iAcceleration

Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
This commit is contained in:
Serban Waltter
2018-07-26 18:06:33 +03:00
parent d431d1458e
commit a411723e5c
48 changed files with 512 additions and 35 deletions

View File

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

View File

@ -25,6 +25,8 @@
#include <string>
#include "bmi160.h"
#include <interfaces/iAcceleration.hpp>
#define BMI160_I2C_BUS 0
#define BMI160_DEFAULT_I2C_ADDR 0x69
@ -72,7 +74,7 @@ namespace upm {
*
* @snippet bmi160.cxx Interesting
*/
class BMI160 {
class BMI160: virtual public iAcceleration {
public:
/**
@ -142,6 +144,13 @@ namespace upm {
*/
void getAccelerometer(float *x, float *y, float *z);
/**
* get acceleration values
*
* @return stl vector of size 3 representing the 3 axis
*/
virtual std::vector<float> getAcceleration();
/**
* Get the Gyroscope values. This function returns a pointer to 3
* floating point values: X, Y, and Z, in that order. The values