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:
Serban Waltter
2018-10-02 16:49:48 +03:00
committed by Mihai Tudor Panu
parent aa966946d5
commit f28a6d2561
36 changed files with 173 additions and 39 deletions

View File

@@ -27,6 +27,8 @@
#include <mraa/common.hpp>
#include <mraa/i2c.hpp>
#include <interfaces/iMagnetometer.hpp>
#define AK8975_I2C_BUS 0
#define AK8975_DEFAULT_I2C_ADDR 0x0c
@@ -50,7 +52,7 @@ namespace upm {
*
* @snippet mpu9150-ak8975.cxx Interesting
*/
class AK8975 {
class AK8975: virtual public iMagnetometer {
public:
/**
@@ -202,6 +204,16 @@ namespace upm {
*/
void getMagnetometer(float *x, float *y, float *z);
/**
* Return magnetometer data in micro-Teslas (uT) in the form
* of a floating point vector. update() must have been called
* prior to calling this method.
*
* @return A floating point vector containing x, y, and z in
* that order.
*/
std::vector<float> getMagnetometer();
protected:
/**