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
bmc150.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 "bmm150.hpp"
30 
31 #define BMC150_DEFAULT_BUS 0
32 #define BMC150_DEFAULT_ACC_ADDR 0x10
33 #define BMC150_DEFAULT_MAG_ADDR 0x12
34 
35 namespace upm {
36 
72  class BMC150 {
73  public:
95  BMC150(int accelBus=BMC150_DEFAULT_BUS,
96  int accelAddr=BMC150_DEFAULT_ACC_ADDR,
97  int accelCS=-1,
98  int magBus=BMC150_DEFAULT_BUS,
99  int magAddr=BMC150_DEFAULT_MAG_ADDR,
100  int magCS=-1);
101 
105  ~BMC150();
106 
110  void update();
111 
125  void initAccelerometer(BMA250E::POWER_MODE_T pwr=BMA250E::POWER_MODE_NORMAL,
126  BMA250E::RANGE_T range=BMA250E::RANGE_2G,
127  BMA250E::BW_T bw=BMA250E::BW_250);
128 
139  void initMagnetometer(BMM150::USAGE_PRESETS_T usage=BMM150::USAGE_HIGH_ACCURACY);
140 
152  void getAccelerometer(float *x, float *y, float *z);
153 
163  float *getAccelerometer();
164 
176  void getMagnetometer(float *x, float *y, float *z);
177 
187  float *getMagnetometer();
188 
189 
190  protected:
191  BMA250E *m_accel;
192  BMM150 *m_mag;
193 
194  private:
195  };
196 }
float * getAccelerometer()
Definition: bmc150.cxx:94
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: bmc150.cxx:65
BW_T
Definition: bma250e.hpp:337
API for the BMM150 3-Axis Geomagnetic Sensor.
Definition: bmm150.hpp:71
~BMC150()
Definition: bmc150.cxx:56
void update()
Definition: bmc150.cxx:79
POWER_MODE_T
Definition: bma250e.hpp:393
BMC150(int accelBus=BMC150_DEFAULT_BUS, int accelAddr=BMC150_DEFAULT_ACC_ADDR, int accelCS=-1, int magBus=BMC150_DEFAULT_BUS, int magAddr=BMC150_DEFAULT_MAG_ADDR, int magCS=-1)
Definition: bmc150.cxx:35
API for the BMC150 6-axis eCompass.
Definition: bmc150.hpp:72
float * getMagnetometer()
Definition: bmc150.cxx:111
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 initMagnetometer(BMM150::USAGE_PRESETS_T usage=BMM150::USAGE_HIGH_ACCURACY)
Definition: bmc150.cxx:73