QuadroCopter  0.1.4
LSM303Magnetometer.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2017 Michael Brookes
3 
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef LSM303_ACCELEROMETER_LSM303Magnetometer_H
19 #define LSM303_ACCELEROMETER_LSM303Magnetometer_H
20 
21 #include "../LSM303DLHC.h"
22 #include <bitset>
23 #include <math.h>
24 
25 using namespace std;
26 
27 namespace quadro {
28 
29  namespace i2c {
30 
31  class LSM303Magnetometer : public LSM303DLHC {
32 
33  public:
34 
42  LSM303Magnetometer( unsigned char _deviceAddress = MAG_ADDRESS, int _busId = 1 );
43 
54  double calcHeading();
55 
63  int start();
64 
65  double heading;
66 
67  pthread_t threadHandle;
68 
69  private:
70 
79  static void* runMainSensorUpdateThread( void* static_inst );
80 
81  int threadRet;
82 
83  };
84  }
85 }
86 #endif //LSM303_ACCELEROMETER_LSM303Magnetometer_H
double heading
Store current calculated heading value;.
Definition: LSM303Magnetometer.h:65
Definition: LSM303DLHC.h:351
Definition: LSM303Magnetometer.h:31
#define MAG_ADDRESS
I2C Address of the magnetometer device.
Definition: LSM303DLHC.h:61
Definition: aeronautics.h:23