Rover API Documentation
rover_qmc5883l.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 FH Dortmund and others
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Description:
9  * RoverQMC5883L API - Interfaces for Rover QMC5883L bearing sensor application development
10  * Header file
11  *
12  * Contributors:
13  * M.Ozcelikors <mozcelikors@gmail.com>, created RoverQMC5883L class 04.12.2017
14  *
15  */
16 
17 #ifndef ROVERAPI_ROVER_QMC5883L_HPP_
18 #define ROVERAPI_ROVER_QMC5883L_HPP_
19 
21 
22 namespace rover
23 {
27  class RoverQMC5883L : public RoverSensor
28  {
29  private:
30  /* Definitions related to compass sensor */
35 
40 
45 
49  mutable unsigned int calibration_start;
50 
55 
59  int16_t xMinRaw;
60 
64  int16_t xMaxRaw;
65 
69  int16_t yMinRaw;
70 
74  int16_t yMaxRaw;
75 
80 
81  public:
85  explicit RoverQMC5883L ();
86 
91 
96  void initialize (void);
97 
102  float read (void);
103 
108  void calibrate (void) const;
109 
115  void setQMC5883LAddress (const int address);
116 
122  void setQMC5883LCalibrationPeriod(const int period);
123 
129  void setQMC5883LDeclinationAngle (const float angle);
130 
135  int getQMC5883LAddress (void);
136 
141  int getQMC5883LCalibrationPeriod (void);
142 
147  float getQMC5883LDeclinationAngle (void);
148 
149  private:
150 
157  template<typename T>
158  inline T MINIMUM_ (const T& a, const T& b);
159 
166  template<typename T>
167  inline T MAXIMUM_ (const T& a, const T& b);
168 
169  };
170 }
171 
172 
173 
174 #endif /* ROVERAPI_ROVER_QMC5883L_HPP_ */
RoverSensor class is an abstract class to define interface between common sensors used in the rover...
Definition: rover_sensor.hpp:48
int16_t xMaxRaw
Calibration variable to hold the maximum of xRaw results.
Definition: rover_qmc5883l.hpp:64
int16_t yMinRaw
Calibration variable to hold the minimum of yRaw results.
Definition: rover_qmc5883l.hpp:69
T MINIMUM_(const T &a, const T &b)
Inline macro to find minimum of two values regardles of their types (template).
Definition: rover_qmc5883l.cpp:180
int QMC5883L_ADDRESS
Address for compass sensor.
Definition: rover_qmc5883l.hpp:34
int16_t yMaxRaw
Calibration variable to hold the maximum of yRaw results.
Definition: rover_qmc5883l.hpp:74
void setQMC5883LCalibrationPeriod(const int period)
Sets the QMC588L Calibration Duration.
Definition: rover_qmc5883l.cpp:159
RoverQMC5883L is a class that is inherited from RoverSensor abstract class. RoverQMC5883L class conta...
Definition: rover_qmc5883l.hpp:27
RoverQMC5883L()
Constructor for the RoverQMC5883L class.
Definition: rover_qmc5883l.cpp:26
rover Namespace contains classes to manage Rover sensors, gpio, buzzer, buttons, driving, utilities, and cloud.
Definition: rover_api.hpp:293
int getQMC5883LAddress(void)
Returns the private attribute QMC588L_ADDRESS.
Definition: rover_qmc5883l.cpp:164
void setQMC5883LAddress(const int address)
Sets the QMC588L Address.
Definition: rover_qmc5883l.cpp:149
float getQMC5883LDeclinationAngle(void)
Returns the QMC588L Declination angle.
Definition: rover_qmc5883l.cpp:169
void setQMC5883LDeclinationAngle(const float angle)
Sets the QMC588L Declination angle.
Definition: rover_qmc5883l.cpp:154
void calibrate(void) const
Starts calibration for the bearing sensor.
void initialize(void)
Function to setup QMC5883L sensor.
Definition: rover_qmc5883l.cpp:43
T MAXIMUM_(const T &a, const T &b)
Inline macro to find maximum of two values regardles of their types (template).
Definition: rover_qmc5883l.cpp:186
float DECLINATION_ANGLE
Declination angle / correction factor for compass sensor.
Definition: rover_qmc5883l.hpp:44
~RoverQMC5883L()
Destructor for the RoverQMC5883L class.
Definition: rover_qmc5883l.cpp:41
int getQMC5883LCalibrationPeriod(void)
Returns the QMC588L Calibration Duration.
Definition: rover_qmc5883l.cpp:174
int ROVERQMC5883L_SETUP_
Flag to hold if RoverQMC5883L is set up.
Definition: rover_qmc5883l.hpp:54
unsigned int calibration_start
Calibration variable for QMC5883L.
Definition: rover_qmc5883l.hpp:49
int i2c_qmc588l_fd
Private member attribute for I2C file descriptor.
Definition: rover_qmc5883l.hpp:79
int16_t xMinRaw
Calibration variable to hold the minimum of xRaw results.
Definition: rover_qmc5883l.hpp:59
int CALIBRATION_DURATION
Calibration duration for compass sensor.
Definition: rover_qmc5883l.hpp:39
float read(void)
Reads the bearing value from Bearing sensor QMC5883L (float).
Definition: rover_qmc5883l.cpp:75