mirror of
https://github.com/eclipse/upm.git
synced 2025-07-05 19:31:15 +03:00
Added iMagnetometer 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:

committed by
Mihai Tudor Panu

parent
aa966946d5
commit
f28a6d2561
@ -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 iGyroscope.hpp
|
||||
IFACE_HDR iAcceleration.hpp iGyroscope.hpp iMagnetometer.hpp
|
||||
# FTI_SRC bmi160_fti.c
|
||||
CPP_WRAPS_C
|
||||
REQUIRES mraa utilities-c)
|
||||
|
@ -101,13 +101,13 @@ std::vector<float> BMI160::getGyroscope()
|
||||
return std::vector<float>(values, values + 3);
|
||||
}
|
||||
|
||||
float *BMI160::getMagnetometer()
|
||||
std::vector<float> BMI160::getMagnetometer()
|
||||
{
|
||||
static float values[3]; // x, y, and then z
|
||||
|
||||
getMagnetometer(&values[0], &values[1], &values[2]);
|
||||
|
||||
return values;
|
||||
return std::vector<float>(values, values + 3);
|
||||
}
|
||||
|
||||
void BMI160::enableMagnetometer(bool enable)
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include <interfaces/iAcceleration.hpp>
|
||||
#include <interfaces/iGyroscope.hpp>
|
||||
#include <interfaces/iMagnetometer.hpp>
|
||||
|
||||
#define BMI160_I2C_BUS 0
|
||||
#define BMI160_DEFAULT_I2C_ADDR 0x69
|
||||
@ -75,7 +76,7 @@ namespace upm {
|
||||
*
|
||||
* @snippet bmi160.cxx Interesting
|
||||
*/
|
||||
class BMI160: virtual public iAcceleration, virtual public iGyroscope {
|
||||
class BMI160: virtual public iAcceleration, virtual public iGyroscope, public virtual iMagnetometer {
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -189,7 +190,7 @@ namespace upm {
|
||||
* @return Pointer to 3 floating point values: X, Y, and Z in
|
||||
* micro Teslas.
|
||||
*/
|
||||
float *getMagnetometer();
|
||||
std::vector<float> getMagnetometer();
|
||||
|
||||
/**
|
||||
* Get the Magnetometer values. The values returned are in micro
|
||||
|
Reference in New Issue
Block a user