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
bmx055.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 #include "bmm150.hpp"
31 
32 namespace upm {
33 
74  class BMX055 {
75  public:
102  BMX055(int accelBus=BMA250E_I2C_BUS,
103  int accelAddr=BMA250E_DEFAULT_ADDR,
104  int accelCS=-1,
105  int gyroBus=BMG160_I2C_BUS,
106  int gyroAddr=BMG160_DEFAULT_ADDR,
107  int gyroCS=-1,
108  int magBus=BMM150_I2C_BUS,
109  int magAddr=BMM150_DEFAULT_ADDR,
110  int magCS=-1);
111 
115  ~BMX055();
116 
120  void update();
121 
135  void initAccelerometer(BMA250E::POWER_MODE_T pwr=BMA250E::POWER_MODE_NORMAL,
136  BMA250E::RANGE_T range=BMA250E::RANGE_2G,
137  BMA250E::BW_T bw=BMA250E::BW_250);
138 
152  void initGyroscope(BMG160::POWER_MODE_T pwr=BMG160::POWER_MODE_NORMAL,
153  BMG160::RANGE_T range=BMG160::RANGE_250,
154  BMG160::BW_T bw=BMG160::BW_400_47);
155 
166  void initMagnetometer(BMM150::USAGE_PRESETS_T usage=BMM150::USAGE_HIGH_ACCURACY);
167 
179  void getAccelerometer(float *x, float *y, float *z);
180 
190  float *getAccelerometer();
191 
203  void getGyroscope(float *x, float *y, float *z);
204 
214  float *getGyroscope();
215 
227  void getMagnetometer(float *x, float *y, float *z);
228 
238  float *getMagnetometer();
239 
240 
241  protected:
242  BMA250E *m_accel;
243  BMG160 *m_gyro;
244  BMM150 *m_mag;
245 
246  private:
247  };
248 }
float * getMagnetometer()
Definition: bmx055.cxx:149
POWER_MODE_T
Definition: bmg160.hpp:329
float * getGyroscope()
Definition: bmx055.cxx:132
BW_T
Definition: bma250e.hpp:337
API for the BMM150 3-Axis Geomagnetic Sensor.
Definition: bmm150.hpp:71
float * getAccelerometer()
Definition: bmx055.cxx:115
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: bmx055.cxx:83
BW_T
Definition: bmg160.hpp:278
API for the BMG160 16 bit Trixial Gyroscope.
Definition: bmg160.hpp:69
~BMX055()
Definition: bmx055.cxx:63
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: bmx055.cxx:75
POWER_MODE_T
Definition: bma250e.hpp:393
RANGE_T
Definition: bma250e.hpp:312
API for the BMA250E 10 bit Trixial Accelerometer.
Definition: bma250e.hpp:71
USAGE_PRESETS_T
Definition: bmm150.hpp:300
void update()
Definition: bmx055.cxx:97
BMX055(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, int magBus=BMM150_I2C_BUS, int magAddr=BMM150_DEFAULT_ADDR, int magCS=-1)
Definition: bmx055.cxx:35
API for the BMX055 9-axis Sensor Module.
Definition: bmx055.hpp:74
void initMagnetometer(BMM150::USAGE_PRESETS_T usage=BMM150::USAGE_HIGH_ACCURACY)
Definition: bmx055.cxx:91
RANGE_T
Definition: bmg160.hpp:253