upm  0.8.0
Sensor/Actuator repository for libmraa (v1.1.1)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bmi055.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #pragma once
25 
26 #include <string>
27 
28 #include "bma250e.hpp"
29 #include "bmg160.hpp"
30 
31 namespace upm {
32 
64  class BMI055 {
65  public:
87  BMI055(int accelBus=BMA250E_I2C_BUS,
88  int accelAddr=BMA250E_DEFAULT_ADDR,
89  int accelCS=-1,
90  int gyroBus=BMG160_I2C_BUS,
91  int gyroAddr=BMG160_DEFAULT_ADDR,
92  int gyroCS=-1);
93 
97  ~BMI055();
98 
102  void update();
103 
117  void initAccelerometer(BMA250E::POWER_MODE_T pwr=BMA250E::POWER_MODE_NORMAL,
118  BMA250E::RANGE_T range=BMA250E::RANGE_2G,
119  BMA250E::BW_T bw=BMA250E::BW_250);
120 
134  void initGyroscope(BMG160::POWER_MODE_T pwr=BMG160::POWER_MODE_NORMAL,
135  BMG160::RANGE_T range=BMG160::RANGE_250,
136  BMG160::BW_T bw=BMG160::BW_400_47);
137 
149  void getAccelerometer(float *x, float *y, float *z);
150 
160  float *getAccelerometer();
161 
173  void getGyroscope(float *x, float *y, float *z);
174 
184  float *getGyroscope();
185 
186 
187  protected:
188  BMA250E *m_accel;
189  BMG160 *m_gyro;
190 
191  private:
192  };
193 }
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:65
~BMI055()
Definition: bmi055.cxx:56
POWER_MODE_T
Definition: bmg160.hpp:329
void update()
Definition: bmi055.cxx:81
BMI055(int accelBus=BMA250E_I2C_BUS, int accelAddr=BMA250E_DEFAULT_ADDR, int accelCS=-1, int gyroBus=BMG160_I2C_BUS, int gyroAddr=BMG160_DEFAULT_ADDR, int gyroCS=-1)
Definition: bmi055.cxx:35
BW_T
Definition: bma250e.hpp:337
API for the BMI055 6-axis Sensor Module.
Definition: bmi055.hpp:64
BW_T
Definition: bmg160.hpp:278
API for the BMG160 16 bit Trixial Gyroscope.
Definition: bmg160.hpp:69
POWER_MODE_T
Definition: bma250e.hpp:393
RANGE_T
Definition: bma250e.hpp:312
float * getGyroscope()
Definition: bmi055.cxx:113
API for the BMA250E 10 bit Trixial Accelerometer.
Definition: bma250e.hpp:71
float * getAccelerometer()
Definition: bmi055.cxx:96
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:73
RANGE_T
Definition: bmg160.hpp:253