Initial implementation of iAcceleration
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
90524273ec
commit
f992876461
@@ -174,6 +174,18 @@ std::vector<float> BMA220::getAccelerometer()
|
||||
return v;
|
||||
}
|
||||
|
||||
std::vector<float> BMA220::getAcceleration()
|
||||
{
|
||||
std::vector<float> v(3);
|
||||
|
||||
update();
|
||||
v[0] = m_accelX / m_accelScale;
|
||||
v[1] = m_accelY / m_accelScale;
|
||||
v[2] = m_accelZ / m_accelScale;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
uint8_t BMA220::getChipID()
|
||||
{
|
||||
return readReg(REG_CHIPID);
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <mraa/i2c.hpp>
|
||||
#include <mraa/gpio.hpp>
|
||||
|
||||
#include <interfaces/iAcceleration.hpp>
|
||||
|
||||
#define BMA220_I2C_BUS 0
|
||||
#define BMA220_DEFAULT_ADDR 0x0a
|
||||
|
||||
@@ -68,7 +70,7 @@ namespace upm {
|
||||
* @snippet bma220.cxx Interesting
|
||||
*/
|
||||
|
||||
class BMA220 {
|
||||
class BMA220: virtual public iAcceleration {
|
||||
public:
|
||||
|
||||
// NOTE: reserved registers must not be written into or read from.
|
||||
@@ -547,6 +549,13 @@ namespace upm {
|
||||
*/
|
||||
std::vector<float> getAccelerometer();
|
||||
|
||||
/**
|
||||
* get acceleration values
|
||||
*
|
||||
* @return stl vector of size 3 representing the 3 axis
|
||||
*/
|
||||
virtual std::vector<float> getAcceleration();
|
||||
|
||||
/**
|
||||
* set the filtering configuration
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user