mirror of
https://github.com/eclipse/upm.git
synced 2025-07-04 10:51:12 +03:00
Initial implementation of iAcceleration
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com>
This commit is contained in:
@ -602,8 +602,14 @@ void H3LIS331DL::getXYZ(int *x, int *y, int*z)
|
||||
|
||||
std::vector<float> H3LIS331DL::getAcceleration()
|
||||
{
|
||||
update();
|
||||
std::vector<float> v(3);
|
||||
getAcceleration(&v[0], &v[1], &v[2]);
|
||||
|
||||
const float gains = 0.003; // Seeed magic number?
|
||||
|
||||
v[0] = float(m_rawX - m_adjX) * gains;
|
||||
v[1] = float(m_rawY - m_adjY) * gains;
|
||||
v[2] = float(m_rawZ - m_adjZ) * gains;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include <mraa/common.hpp>
|
||||
#include <mraa/i2c.hpp>
|
||||
|
||||
#include <interfaces/iAcceleration.hpp>
|
||||
|
||||
#define H3LIS331DL_I2C_BUS 0
|
||||
#define H3LIS331DL_DEFAULT_I2C_ADDR 0x18
|
||||
|
||||
@ -56,7 +58,7 @@ namespace upm {
|
||||
* @image html h3lis331dl.jpg
|
||||
* @snippet h3lis331dl.cxx Interesting
|
||||
*/
|
||||
class H3LIS331DL {
|
||||
class H3LIS331DL: virtual public iAcceleration {
|
||||
public:
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user