upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
bmi055.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016-2017 Intel Corporation.
4  *
5  * The MIT License
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  */
26 #pragma once
27 
28 #include <string>
29 #include <vector>
30 
31 #include "bma250e.hpp"
32 #include "bmg160.hpp"
33 
34 namespace upm {
35 
67  class BMI055 {
68  public:
90  BMI055(int accelBus=BMA250E_DEFAULT_I2C_BUS,
91  int accelAddr=BMA250E_DEFAULT_ADDR,
92  int accelCS=-1,
93  int gyroBus=BMG160_DEFAULT_I2C_BUS,
94  int gyroAddr=BMG160_DEFAULT_ADDR,
95  int gyroCS=-1);
96 
100  ~BMI055();
101 
105  void update();
106 
120  void initAccelerometer(
121  BMA250E_POWER_MODE_T pwr=BMA250E_POWER_MODE_NORMAL,
122  BMA250E_RANGE_T range=BMA250E_RANGE_2G,
123  BMA250E_BW_T bw=BMA250E_BW_250);
124 
138  void initGyroscope(BMG160_POWER_MODE_T pwr=BMG160_POWER_MODE_NORMAL,
139  BMG160_RANGE_T range=BMG160_RANGE_250,
140  BMG160_BW_T bw=BMG160_BW_400_47);
141 
153  void getAccelerometer(float *x, float *y, float *z);
154 
163  std::vector<float> getAccelerometer();
164 
176  void getGyroscope(float *x, float *y, float *z);
177 
186  std::vector<float> getGyroscope();
187 
188 
189  protected:
190  BMA250E *m_accel;
191  BMG160 *m_gyro;
192 
193  private:
194  /* Disable implicit copy and assignment operators */
195  BMI055(const BMI055&) = delete;
196  BMI055 &operator=(const BMI055&) = delete;
197  };
198 }
std::vector< float > getAccelerometer()
Definition: bmi055.cxx:98
~BMI055()
Definition: bmi055.cxx:58
void update()
Definition: bmi055.cxx:83
API for the BMI055 6-axis Sensor Module.
Definition: bmi055.hpp:67
BMI055(int accelBus=BMA250E_DEFAULT_I2C_BUS, int accelAddr=BMA250E_DEFAULT_ADDR, int accelCS=-1, int gyroBus=BMG160_DEFAULT_I2C_BUS, int gyroAddr=BMG160_DEFAULT_ADDR, int gyroCS=-1)
Definition: bmi055.cxx:37
API for the BMG160 16 bit Triaxial Gyroscope.
Definition: bmg160.hpp:74
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
void initGyroscope(BMG160_POWER_MODE_T pwr=BMG160_POWER_MODE_NORMAL, BMG160_RANGE_T range=BMG160_RANGE_250, BMG160_BW_T bw=BMG160_BW_400_47)
Definition: bmi055.cxx:75
API for the BMA250E 10 bit Triaxial Accelerometer.
Definition: bma250e.hpp:76
std::vector< float > getGyroscope()
Definition: bmi055.cxx:112
void initAccelerometer(BMA250E_POWER_MODE_T pwr=BMA250E_POWER_MODE_NORMAL, BMA250E_RANGE_T range=BMA250E_RANGE_2G, BMA250E_BW_T bw=BMA250E_BW_250)
Definition: bmi055.cxx:67